[Radiant] Best way to refer to a stylesheet?

Chris Parrish chris.parrish-forummail at swankinnovations.com
Sat Jun 7 19:08:13 CDT 2008


I see that Casper already sent a reply but I thought I'd mention the 
Styles 'n Scripts extension here since it was made to make things like 
this simpler.  You would simply use the <r:stylesheet> or <r:javascript> 
tag in your Page/Layout/Snippet to render the thing you want:

<r:stylesheet name="my_stylesheet.css" as="link" />
   generates:
<link rel="stylesheet" href="/css/my_stylesheet.css" type="text/css" />

while...
<r:stylesheet name="my_stylesheet.css" as="url" />
    generates:
/css/my_stylesheet.css

Of course the /css directory in the examples is the extension's default 
but you can change that to whatever you want.

You can also use these tags to pull the content from a stylesheet of 
javascript into your document's <head> section.

-Chris


John and Catherine Allen wrote:
> This has to be a really basic question, but despite reading the 
> documentation and many mailing list posts, I still don't get it...
>
> For stylesheets which are stored in the database
> 1) In a layout, what is the recommended way to refer to a stylesheet ?
> 2) In a page, what is the recommended way to refer to a stylesheet ?
>
> My stylesheets work fine when I refer to them as files in the 
> filesystem, but not when they are in the database.
>
> John
>



More information about the Radiant mailing list