Skip to content

Instantly share code, notes, and snippets.

@MoOx
Last active December 25, 2015 14:49
Show Gist options
  • Save MoOx/6993341 to your computer and use it in GitHub Desktop.
Save MoOx/6993341 to your computer and use it in GitHub Desktop.
Does @at-root worth it?
.org-Component {
}
.org-Component-subChild {
}
.org-Component-subChild--modifier {
}
// http://sass-lang.com/documentation/file.SASS_CHANGELOG.html#318
.org {
#{&}-Component {
#{&}-subChild {
#{&}--modifier {
}
}
}
}
.org {
@at-root #{&}-Component {
@at-root #{&}-subChild {
@at-root #{&}--modifier {
}
}
}
}}
@jjenzz
Copy link

jjenzz commented Apr 7, 2014

Disadvantages of this is it makes Find All really difficult. When I am a new developer on a particular project, I rely heavily on Find All to tell me if pieces of code are still being used in the codebase or used elsewhere or just to find where they're declared within a file structure I'm not yet used to.

If I saw class="org-Component-subChild--modifier" in the markup then I would search for org-Component-subChild--modifier and find nothing. This might make me think it's not being used and I would clean up the markup referencing it, or if I am sure it is being used, it makes finding the declaration more difficult than necessary.

Although this approach looks neat and saves some typing, I feel quite strongly against it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment