Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First commit

  • Loading branch information...
commit 5e963bdd1f3d6cb8dd5ef81e58ca44977c188427 0 parents
@wilsonpage authored
Showing with 57 additions and 0 deletions.
  1. +38 −0 README.md
  2. +10 −0 component.json
  3. +9 −0 index.scss
38 README.md
@@ -0,0 +1,38 @@
+
+# SASS Import Once
+
+ When included in a SASS module, sass-import-once will prevent the styles being duplicated if `@import` is called somewhere else. This is cool because it allows every SASS file to declare its own dependencies. This promotes encapulation and allows modules to standalone if need be.
+
+## Installation
+
+ Just copy the index.scss file somewhere into your project.
+
+```
+$ component install wilsonpage/sass-import-once
+```
+
+## Usage
+
+```
+$filename: 'defaults.scss';
+@import 'sass-import-once';
+@if not-imported($filename) {
+/*******************************************/
+
+html,
+body {
+ width: 100%;
+ height: 100%;
+}
+
+body {
+ background-color: #333;
+}
+
+/*******************************************/
+}
+```
+
+## License
+
+ MIT
10 component.json
@@ -0,0 +1,10 @@
+{
+ "name": "sass-import-once",
+ "description": "Declares a module that should only be imported once",
+ "version": "0.1.0",
+ "keywords": "sass",
+ "files": [
+ "index.scss"
+ ],
+ "licence": "MIT"
+}
9 index.scss
@@ -0,0 +1,9 @@
+$imported: () !default;
+@function not-imported($file) {
+ @if index($imported, $file) {
+ @return false;
+ } @else {
+ $imported: append($imported, $file);
+ @return true;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.