@carbon/import-once
Advanced tools
Comparing version 0.0.1-alpha.25 to 0.0.1-alpha.26
{ | ||
"name": "@carbon/import-once", | ||
"description": "Sass helper for importing files only once. Used in the Carbon Design System", | ||
"version": "0.0.1-alpha.25", | ||
"version": "0.0.1-alpha.26", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/IBM/carbon-elements/tree/master/packages/import-once", |
@@ -22,2 +22,31 @@ # @carbon/import-once | ||
## Usage | ||
`@carbon/import-once` is helpful when needing to guarantee that a | ||
module is loaded only once. It does this by exporting a `exports` | ||
mixin that you can use. | ||
This mixin is particularly useful when you have a situation where your | ||
work might share common dependencies that you don't want duplicated. | ||
For example, imagine we had modules `a.scss` and `b.scss` that both | ||
import `c.scss`. Using the `exports` mixin from `@carbon/import-once` | ||
will guarantee that `c.scss` is loaded only once. | ||
This looks like: | ||
```scss | ||
// a.scss | ||
@import 'c'; | ||
// b.scss | ||
@import 'c'; | ||
// c.scss | ||
@import '@carbon/import-once/scss/import-once'; | ||
@include exports('c') { | ||
// ... | ||
} | ||
``` | ||
## 🙌 Contributing | ||
@@ -24,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
2981
61