Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Styler

1,752 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Styler

  1. 1. Patrick Crowley the.railsi.st
  2. 2. Styler <%= stylesheets %>
  3. 3. DRY up stylesheet configuration
  4. 4. <head> <title>Fruit stand</title> <%= stylesheet_link_tag quot;applicationquot; %> </head>
  5. 5. <head> <title>Fruit stand</title> <%= stylesheet_link_tag quot;applicationquot; %> <%= stylesheet_link_tag quot;applesquot; %> </head>
  6. 6. <head> <title>Fruit stand</title> <%= stylesheet_link_tag quot;applicationquot; %> <%= stylesheet_link_tag quot;applesquot; %> <%= stylesheet_link_tag quot;bananasquot; %> </head>
  7. 7. <head> <title>Fruit stand</title> <%= stylesheet_link_tag quot;applicationquot; %> <%= stylesheet_link_tag quot;applesquot; %> <%= stylesheet_link_tag quot;bananasquot; %> <%= stylesheet_link_tag quot;cherriesquot; %> </head>
  8. 8. <head> <title>Fruit stand</title> <%= stylesheet_link_tag quot;applicationquot; %> <%= stylesheet_link_tag quot;applesquot; %> <%= stylesheet_link_tag quot;bananasquot; %> <%= stylesheet_link_tag quot;cherriesquot; %> <!--[if IE 7]> <%= stylesheet_link_tag quot;ie7quot; %> <![endif]--> </head>
  9. 9. <head> <title>Fruit stand</title> <%= stylesheet_link_tag quot;applicationquot; %> <%= stylesheet_link_tag quot;applesquot; %> <%= stylesheet_link_tag quot;bananasquot; %> <%= stylesheet_link_tag quot;cherriesquot; %> <!--[if IE 7]> <%= stylesheet_link_tag quot;ie7quot; %> <![endif]--> <!--[if IE 6]> <%= stylesheet_link_tag quot;ie6quot; %> <![endif]--> </head>
  10. 10. <head> <title>My website</title> <%= stylesheet_link_tag quot;applicationquot; %> <% [quot;applesquot;, quot;bananasquot;, quot;cherriesquot;].each do |s| if controller.controller_name == s stylesheet_link_tag s end %> <!--[if IE 7]> <%= stylesheet_link_tag quot;ie7quot; %> <![endif]--> <!--[if IE 6]> <%= stylesheet_link_tag quot;ie6quot; %> <![endif]--> </head>
  11. 11. Let’s DRY it up!
  12. 12. <head> <title>My website</title> <%= stylesheet_link_tag quot;applicationquot; %> <% [quot;applesquot;, quot;bananasquot;, quot;cherriesquot;].each do |s| if controller.controller_name == s stylesheet_link_tag s end %> <!--[if IE 7]> <%= stylesheet_link_tag quot;ie7quot; %> <![endif]--> <!--[if IE 6]> <%= stylesheet_link_tag quot;ie6quot; %> <![endif]--> </head>
  13. 13. <head> <title>My website</title> <%= stylesheets %> </head>
  14. 14. Use Rails naming conventions for css
  15. 15. application.css controller.css controller_action.css
  16. 16. ie7.css ie6.css (conditionally)
  17. 17. Need more?
  18. 18. <head> <title>My website</title> <%= stylesheets :include => quot;resetquot; %> </head>
  19. 19. <head> <title>My website</title> <%= stylesheets :include => [quot;resetquot;, quot;fontsquot;] %> </head>
  20. 20. Generator
  21. 21. script/generate stylesheets
  22. 22. Download now at http://the.railsi.st
  23. 23. The End

×