Skip to content

Instantly share code, notes, and snippets.

@webbower
Forked from StefanoRausch/include-once.scss
Created December 19, 2018 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webbower/a429eb9f720e1bfa82355562b799e901 to your computer and use it in GitHub Desktop.
Save webbower/a429eb9f720e1bfa82355562b799e901 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment