Created
December 11, 2013 14:04
-
-
Save indieisaconcept/7910953 to your computer and use it in GitHub Desktop.
Example of how not namespacing your variables can make it easier to maintain
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
<div class="module"> | |
<p>This is an example of using namespaced variables</p> | |
</div> | |
<div class="box">BOX</div> |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
// config/_base.scss | |
$base-font-size: 18px; | |
$module-base-font-size: 11px; | |
$box-base-font-size: 25px; | |
// component/module.scss | |
$base-font-size: 50px !default; | |
// component/box.scss | |
$base-font-size: 10px !default; | |
.module p { | |
font-size: $module-base-font-size; | |
} | |
.box { | |
background: red; | |
color: white; | |
font-size: $box-base-font-size; | |
width: 100px; | |
height: 100px; | |
} |
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
.module p { | |
font-size: 11px; | |
} | |
.box { | |
background: red; | |
color: white; | |
font-size: 25px; | |
width: 100px; | |
height: 100px; | |
} |
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
<div class="module"> | |
<p>This is an example of using namespaced variables</p> | |
</div> | |
<div class="box">BOX</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment