Skip to content

Instantly share code, notes, and snippets.

@jonnybojangles
Forked from courtsimas/gist:1167053
Last active December 19, 2015 07:48
Show Gist options
  • Save jonnybojangles/5920859 to your computer and use it in GitHub Desktop.
Save jonnybojangles/5920859 to your computer and use it in GitHub Desktop.
I place this function atop my main/primary SASS file for all modules with in a site or project. When multiple modules are combined in a layout the main/primary styles are not duplicated each time. Thanks to user courtsimas and !default http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#variable_defaults_
$imported-once-files: () !default;
@function import-once($name) {
@if index($imported-once-files, $name) {
@return false;
}
$imported-once-files: append($imported-once-files, $name);
@return true;
}
@if import-once("_style.scss"){
//base styles and declarations of cool sass-iness that you only want included once
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment