Skip to content

How to link to a stylesheet using stylesheet link tag

macourtney edited this page Sep 13, 2010 · 3 revisions

Added for version: 0.4
Updated for version: 0.7

If you want to link to a stylesheet, you can use the stylesheet-link-tag in your views.

You’ll likely only want to use stylesheet-link-tag in your layouts.

Conjure assumes all of your stylesheets are in the resources/public/stylesheets directory. If you want to change the directory, update the stylesheets-dir var in config/environment.clj

To link to the stylesheet “main.css” use:

(stylesheet-link-tag "main.css")

If you want to set attributes on the stylesheet link, you can pass and html-options map. To override the media attribute and set it to “screen” use:

(stylesheet-link-tag "main.css" { :media "screen" })

You can also link to more than one stylesheet at a time. To link to “main.css”, “print.css” and “aural.css” in one line use:

(stylesheet-link-tag ["main.css", "print.css", "aural.css"])

You can still use the html-options map with multiple stylesheets. All of the stylesheet links will have the same attributes. To set all of the stylesheet link media attributes to “screen” use:

(stylesheet-link-tag ["main.css", "print.css", "aural.css"] { :media "screen" })
Clone this wiki locally