Created
January 6, 2016 12:42
-
-
Save anatomic/61ae591b2915b1ee9dc1 to your computer and use it in GitHub Desktop.
Simple Sass Modules
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
/** | |
* Simple Sass Modules | |
* | |
* Prevent output from Sass modules when @imported more than once. Allows for | |
* modules to declare their own dependencies without a global stylesheet having to know what | |
* to include and without fear CSS will be exported multiple times. | |
* | |
*/ | |
/** | |
* Stores a list of all the currently exported modules to help with dependency management | |
* @type list | |
* @access private | |
*/ | |
$modules: ()!default; | |
/** | |
* Core mixin for managing dependencies through the framework and your project | |
* | |
* @author Ian Thomas | |
* @param {String} $name - The name of your component | |
* @example scss | |
* @include exports('my-component') { | |
* .class { ... } | |
* } | |
*/ | |
@mixin exports($name){ | |
@if index($modules, $name) == false { | |
$modules: append($modules, $name); | |
@content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment