You can solve item #2 using <r:stylesheet> and multiple stylesheet files. Just like you can use the <r:javascript> to reference multiple libraries and create a one-script-to-rule-them-all master to just serve up one library file, you can also incorporate many stylesheets into one master.

So you could create:

where main.css includes:
 ... some stylesheet definitions...
 <r:stylesheet name="main-colors.css" />
 ... the rest of your style definitions ...

then you'd just stick all your colors in... wait for it... "main-colors.css"

Of course what's missing there is the neat UI grouping that parts tabs afford. But what's also missing is the hassle of building, testing, and maintaining a parts structure (abstract_controller really keen on managing has-many sub-models and I have to build my own new table structure since Parts isn't really designed for subclassing).

Originally, I debated page parts but decided that, since the audience was more technical, making them mentally keep track of several separate stylesheets that aren't conveniently visible via tabs seemed acceptable and worth the trade off (after all if they can keep track of CSS rules and their impact on the page, they can juggle 3 or 4 files).

Now, having said all that. Are you using my Sass filter plugin? If not, I might consider it. Sass has a notation for setting document-wide constants so you could, say, declare all your color info at the very top and maybe get by with only one stylesheet. From the Sass documentation:

 !main_color = #00ff00

   :color = !main_color
     :background-color = !main_color
     :color #000000

More at:

I'll respond to item #1 in a separate email.


Jim Gay wrote:
I was working to move my page based stylesheets into the styles_n_scripts extension when I ran into a problem.

I'd love to see 2 features of doing stylesheets in pages:
1) support for radius tags from pages
2) page parts (or something like it)

I have one client that is managing the design of the site, but we're handling the HTML/CSS. So in the stylesheet, I use something like
#header {
background: url('<r:find url="/"><r:attachment:url name="logo.png" />') no-repeat left top;

This allows them to use page_attachments to change images specified in the stylesheet without needing to muck about in CSS.

Less importantly, I break out the stylesheet into different parts to make it easier to manage, but also easier for the client to update. For example, I'll add <r:content part="colors" /> to the body which is the part of the stylesheet (page) where all of the colors are specified. The client can go in and go directly to the colors part and knows enough to edit the part for particular items in the site. I'll only put the color information in the colors part so that the extra CSS declarations don't confuse them.

The reason I found this is because of this which is fixed in the version of Rails later than what is currently in Radiant. But my form data was apparently too big to be saved properly by Rails.
Radiant mailing list

Radiant mailing list

Reply via email to