Last active
December 27, 2015 05:09
-
-
Save robatron/7271773 to your computer and use it in GitHub Desktop.
Front-End Architecture: Root LESS files and how to "parameterize" component styles.
This file contains 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
/** 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 ); |
This file contains 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
/** 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; | |
} | |
} |
This file contains 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
/* 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