Skip to content

Instantly share code, notes, and snippets.

@robatron
Last active December 27, 2015 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robatron/7271773 to your computer and use it in GitHub Desktop.
Save robatron/7271773 to your computer and use it in GitHub Desktop.
Front-End Architecture: Root LESS files and how to "parameterize" component styles.
/** Root LESS file for the page where component styles are imported.
*/
// Import components LESS file
@import "component"
// Include component style as a mixin which CAN be included outside of a directive block
.component( 'blue'; 10px );
/** Component styling
*/
// Entire component style wrapped within a parametric mixin
.component( @bg-color; @padding ){
// Actual component selector
.components-selector {
background-color: @bg-color;
padding: @padding;
}
}
/* Result page CSS
*/
.components-selector {
background-color: blue;
padding: 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment