You are here: Browse Railsplugins Styler
====== Styler is designed to DRY up the process of including and generating stylesheets, so you can think less about stylesheet configuration and more about styling.
To use Styler, just update your layout(s) with this code:
<head> <title>the.rails.ist</title> <%= stylesheets %> </head>
Styler will then include your stylesheets automatically:
<head> <title>the.rails.ist</title> <link href=”/stylesheets/application.css?1170968897” /> <!—[if IE 7]> <link href=”/stylesheets/ie7.css?1170968897” /> <![endif]—> <!—[if IE 6]> <link href=”/stylesheets/ie6.css?1170968897” /> <![endif]—> </head>
Styler will also dynamically include stylesheets for each of your controllers (if such stylesheets are present), so you can keep your styles organized into logical sections.
Styler uses a simple set of conventions:
- Styles for your entire application should be stored in application.css - Styles for specific controllers should be stored in controller.css - Styles for specific actions should be stored in controller_action.css - Styles for Internet Explorer 7 should be stored in ie7.css - Styles for Internet Explorer 6 should be stored in ie6.css
When used in combination, these conventions can scale up to support pretty big applications.
Conventions are great, but need to add your own stylesheets?
<%= stylesheets :include => “reset” %> <%= stylesheets :include => [“reset”, “fonts”] %>
For bigger projects, you might wish to break your stylesheets into separate directories.
To use nested stylesheets, just create subdirectories in public/stylesheets for each of your controllers, and then add stylesheets for individual actions you wish to style.
- Styles for an entire controller should be stored in controller.css - Styles for specific actions should be stored in controller/action.css
Styler also includes a generator that will create a default set of stylesheets (application.css, ie7.css, and ie6.css) and a separate stylesheet for each controller in your application.
To use the generator, run this command in your terminal:
script/generate stylesheets
If you add a new controller, just run the generator again and a new stylesheet for the controller will be created. (Styler will safely ignore any existing stylesheets.)
Comments, bug reports, and svn diffs welcome at http://the.railsi.st.
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly