Last active
December 14, 2015 08:49
-
-
Save torkiljohnsen/5061018 to your computer and use it in GitHub Desktop.
Example of the issue at hand: .nav gets imported multiple times
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
<html> | |
<head> | |
<link href="site.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<ul class="nav nav--vertical"> | |
<li>Menu item in vertical menu</li> | |
<li>Menu item in vertical menu</li> | |
</ul> | |
<ul class="nav nav--horizontal"> | |
<li>Menu item in horizontal menu</li> | |
<li>Menu item in horizontal menu</li> | |
</ul> | |
</body> | |
</html> |
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
@import 'nav--horizontal'; | |
@import 'nav--vertical'; | |
/* | |
The output here will show .nav twice in the compiled css. | |
Challenge here is that variants of nav should be independent and should | |
not know about one another, but should still avoid importing nav twice. | |
Example scenario: | |
----------------- | |
Mr Widget Maker may make widgetA, while Dr Widget Master makes widgetB. | |
They use two different .nav variants. Mrs Clever Siteowner decides to | |
put both widgetA and widgetB on the same website, thus .nav will be | |
imported twice in this case. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment