@stead/import-once

0.1.1 • Public • Published

@stead/import-once

Sass helper for importing files only once. Used in the Stead Design System

Getting started

To install @stead/import-once in your project, you will need to run the following command using npm:

npm install -S @stead/import-once

If you prefer Yarn, use the following command instead:

yarn add @stead/import-once

Usage

@stead/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 @stead/import-once will guarantee that c.scss is loaded only once.

This looks like:

// a.scss
@import 'c';

// b.scss
@import 'c';

// c.scss
@import '@stead/import-once/scss/import-once';

@include exports('c') {
  // ...
}

📖 API Documentation

If you're looking for @stead/import-once API documentation, check out:

🙌 Contributing

We're always looking for contributors to help us fix bugs, build new features, or help us improve the project documentation. If you're interested, definitely check out our Contributing Guide! 👀

📝 License

Licensed under the Apache 2.0 License.

Readme

Keywords

Package Sidebar

Install

npm i @stead/import-once

Weekly Downloads

0

Version

0.1.1

License

Apache-2.0

Unpacked Size

16.2 kB

Total Files

6

Last publish

Collaborators

  • mecolela