External javascripts, stylesheets, etc

Hi, folks. I have another question which I realize must be painfully
obvious to most of you. I’m still confused about a few things.

On the default radiant layout. Within the admin, on the ‘Pages’ tab
there is a page called ‘styles’ which contains all the css for the
site. This ‘styles’ page has a layout option called stylesheet. When
I go to the layouts tab there is a layout named ‘stylesheets’ that
only contains <r:content />

What is the process? Does radiant automatically create the css from
the ‘page’ file and stick it in the public/stylesheets directory? Or
does it embed them into the outputted xhtml?

If I create a ‘layout’ named “javascripts” and then I create a
‘page’ with javascript in it and the layout option ‘javascripts’ will
radiant automatically create my javascript file and place it in the
javascripts folder?

My goal is to have all javascript and css external from the xhtml.
Would I be better off just creating my own ‘css’ & ‘scripts’ folders
within the public directory and just referencing them from snippets
and layouts as I would with images?

thanks,
mike

Mike,

Not exactly. Another layout or page would need to refer to the Radiant
page
(CSS, Javascript) by its URL for it to be used.

The real reason they need a layout is to set the content-type. Other
than
that, it makes good sense to just dump the content of the page when it’s
CSS
or Javascript, unless you’re doing something programmatic (i.e. Radius
tags)
in them.

So, to create your own text-based assets in Radiant, you would simply
enter
the content of the file, assign it the Stylesheet or Javascript layout
template, take note of the “slug” (click “more” near the title) and
construct the appropriate URL to the asset based on its slug, parent
slugs
and root URL path of your application. Then you can use that path/URL
in
your layouts, snippets, or other pages.

Hope this helps!

Sean C.
seancribbs.com

Just to add a bit to Sean’s reply:

On 17/08/2006, at 12:27 AM, Michael M. wrote:

My goal is to have all javascript and css external from the xhtml.
Would I be better off just creating my own ‘css’ & ‘scripts’ folders
within the public directory and just referencing them from snippets
and layouts as I would with images?

It depends how you work with your CSS and scripts. If you want to be
able to edit them online in the same way you edit your page content,
then stick them in Radiant. If, like me, you prefer to edit scripts in
a “real” editor (not in a browser textarea) then I’d say put them in
your public directory.

Bodhi

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs