Skip to content

Instantly share code, notes, and snippets.

@alxjrvs
Created June 9, 2014 05:07
Show Gist options
  • Save alxjrvs/50204fbc00520a477a8c to your computer and use it in GitHub Desktop.
Save alxjrvs/50204fbc00520a477a8c to your computer and use it in GitHub Desktop.
Body_attributes method for Namespacing CSS
#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