Last active
August 29, 2015 14:23
-
-
Save inxilpro/fd2f6397392dddf7f1ff to your computer and use it in GitHub Desktop.
LESS preprocessor idea
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
| /* Source LESS file */ | |
| .my-component { | |
| background: #eee; | |
| .subcomponent { | |
| color: #000; | |
| } | |
| &.extreme { | |
| background: red; | |
| .subcomponent { | |
| font-weight: bold; | |
| } | |
| } | |
| } |
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
| /* Generated CSS file */ | |
| .my-component { | |
| background: #eee; | |
| } | |
| /* Note that it keeps original definition so that even if some of your HTML | |
| doesn't go thru the build system, it will continue to work fine, just won't | |
| be quite as performant. */ | |
| .my-component .subcomponent, | |
| .my-component__subcomponent { | |
| color: #000; | |
| } | |
| .my-component.extreme, | |
| .my-component--extreme { | |
| background: red; | |
| } | |
| .my-component.extreme .subcomponent, | |
| .my-component--extreme__subcomponent { | |
| font-weight: bold; | |
| } |
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
| <!-- Source HTML file --> | |
| <div class="my-component class-with-no-rules"> | |
| <span class="subcomponent">Hello world.</span> | |
| </div> | |
| <div class="my-component extreme class-with-no-rules"> | |
| <span class="subcomponent">Hello world.</span> | |
| </div> |
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
| <!-- Generated HTML file --> | |
| <div class="my-component class-with-no-rules"> | |
| <span class="my-component__subcomponent">Hello world.</span> | |
| </div> | |
| <div class="my-component--extreme class-with-no-rules"> | |
| <span class="my-component--extreme__subcomponent">Hello world.</span> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment