Hello folks, I am creating a simple RoR plugin, mostly to teach myself the art of plugin-coding. The plugin is mostly a helper plugin, generating HTML code. Now I would like to include a CSS stylesheet ; the idea is to supply a "my_plugin_css" helper to print a link to the css stylesheet in the template head, but if there is a way to auto-load a css (that is, withoutb the plugin user intervention) I''d be happy to use it. Anyway, my main problem now is telling rails to load my css file as if it was in the usual "plublic/stylesheet" folder. Any suggestion? Davide -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I don''t think it is a good idea to try to ''auto-load'' a css. The css is used in a layout, but it''s up to the user to specify which layout or layouts she wants to use your plugin in. Also, your css rules may colide with someone else''s code and if you auto-load it, it would be very hard to catch and debug. I would instead use your plugin''s install.rb to move the css to public/ stylesheets, and include instructions on how to include the CSS in layouts. My $0.02. On Mar 27, 3:51 am, Davide Benini <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello folks, > I am creating a simple RoR plugin, mostly to teach myself the art of > plugin-coding. > The plugin is mostly a helper plugin, generating HTML code. > Now I would like to include a CSS stylesheet ; the idea is to supply a > "my_plugin_css" helper to print a link to the css stylesheet in the > template head, but if there is a way to auto-load a css (that is, > withoutb the plugin user intervention) I''d be happy to use it. > Anyway, my main problem now is telling rails to load my css file as if > it was in the usual "plublic/stylesheet" folder. > Any suggestion? > Davide > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I would instead use your plugin''s install.rb to move the css to public/ > stylesheets, and include instructions on how to include the CSS in > layouts.You''re definitely right here, and retrospectively it''s quite obvious, use install.rb and copy it. Thanks for your suggestion, Davide -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---