Created
September 28, 2013 17:51
-
-
Save StefanoRausch/6744610 to your computer and use it in GitHub Desktop.
Import Once Feature Implemented in Sass.
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
$is-included : () !default; | |
@mixin once( $name ) { | |
@if include-once( $name ) { | |
@content; | |
} | |
} | |
@function include-once( $name ) { | |
@if index( $is-included, $name ) { | |
@return false; | |
} | |
$is-included : append( $is-included, $name ); | |
@return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to sass/sass#156 and https://gist.github.com/courtsimas/1167053 for the initial idea.