Skip to content

Instantly share code, notes, and snippets.

@StefanoRausch
Created September 28, 2013 17:51
Show Gist options
  • Save StefanoRausch/6744610 to your computer and use it in GitHub Desktop.
Save StefanoRausch/6744610 to your computer and use it in GitHub Desktop.
Import Once Feature Implemented in Sass.
$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;
}
@StefanoRausch
Copy link
Author

Thanks to sass/sass#156 and https://gist.github.com/courtsimas/1167053 for the initial idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment