Created
July 21, 2011 17:18
-
-
Save luizfonseca/1097672 to your computer and use it in GitHub Desktop.
Better loading of styles on a Rails Application :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%h1 When using HAML, or even the rails .erb format, you can improve the loading of your pages using: | |
= stylesheet_link_tag controller.action_name | |
%span Or | |
= stylesheet_link_tag self.current_method | |
%span And create the proper CSS file in the public/style folder (e.g.: action_name.(s)css/ current_method.(s)css. | |
With this, the user only requests the CSS file from that page he is visiting. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But the @controller.action_name is deprecated already. The following is the correct way to call it: