Created
June 9, 2014 05:07
-
-
Save alxjrvs/50204fbc00520a477a8c to your computer and use it in GitHub Desktop.
Body_attributes method for Namespacing CSS
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
#Template in HAMl using Literal Syntax | |
body{ body_attributes} | |
#Method in ApplicationHelper | |
def body_attributes | |
{ | |
class: [controller.controller_name, controller.action_name].join(' ') | |
} | |
end | |
# in your posts/show.css.ass | |
body.posts.show | |
some.sass | |
goes: "here" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment