Is there any way to include a CSS style sheet in an extension? If not, what is the preferred way of styling elements in an extension?
on 2007-01-28 02:17
on 2007-01-28 06:42
Copy it to public as part of the activate method and the inverse in deactive? I have been keeping my stylesheets and related js files in /public/ extensions/name_of_extension/stylesheets and --/scripts. This makes sense to me. The more cumbersome part is making sure that the future user knows to add the stylesheet to their layout as part of the installation of the extension. Now if you're asking about stylesheets within the admin area purely, take a look at the head of the application layout (/app/views/layouts/ application.rhtml)... It seems you may be able to inject stylesheet references by adding them somehow to the @stylesheets array. Sean Cribbs in a recent response to my question also insinuated that there is provision for doing this though I've not yet looked any further into it. Hope that's of some help, Loren Johnson www.fn-group.com
on 2007-01-28 15:46
Loren, I've had some discussions with John in the past about how this should work. There are two possibilities that I remember: 1) SiteController copies "assets" from your extension's "public" directory to the application's public directory on demand. 2) Provide a rake task to copy them or directive in the extension definition that copies assets on startup. Sean
on 2007-01-28 20:17
My opinion is that the first option would be the least intrusive as long as it takes note of the last modified timestamps to recopy them when they change. Regards, Kaleb
on 2007-01-28 20:31
You've revealed why that option could be somewhat inflexible. Once it has been copied, it will be served as a static file by the webserver. I would prefer for it to be copied on activation of the extension, then it is up-to-date on startup. Sean
on 2007-01-28 20:39
Copying upon activation seems like a sensible solution but I'm not sure I follow how it is inflexible to copy the file as soon as it changes. Then it is always up to date regardless of deactivating/activating the extension. I didn't express it but I would have assumed that there would be an initial copy of the file upon startup so you don't have "touch" the file for it to be copied. Regards, Kaleb
on 2007-01-29 01:10
Well, maybe not inflexible, but impractical. The problem is that you'd have to have some process/controller checking the file's timestamp on every access. This means preventing Apache/lighttpd/Litespeed/whatever from sending the file directly, which is proven to be much faster anyway. I'm not trying to prematurely optimize, just suggesting that it would add complexity. Sean
on 2007-01-29 01:22
I can definitely appreciate the impracticality of checking file timestamps each time, however, would you agree that under development mode it may be a good option to have available?
on 2007-09-26 15:13
On activation couldnt you overload the controller method to point to the extension's css path instead of the site's css path?
on 2007-09-28 00:05
Or perhaps have a standard hook that allows an extension to copy the css/js/image files to the standard path when the extension is installed/upgraded?? On 9/26/07, Tim Glenn <firstname.lastname@example.org> wrote: > On activation couldnt you overload the controller method to point to the > extension's css path instead of the site's css path? > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Radiant mailing list > Post: Radiant@lists.radiantcms.org > Search: http://radiantcms.org/mailing-list/search/ > Site: http://lists.radiantcms.org/mailman/listinfo/radiant > -- Regards, Hiram Blog: http://hiramchirino.com