Socket
Socket
Sign inDemoInstall

@carbon/import-once

Package Overview
Dependencies
0
Maintainers
20
Versions
91
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @carbon/import-once

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


Version published
Weekly downloads
28K
increased by18.21%
Maintainers
20
Install size
14.3 kB
Created
Weekly downloads
 

Readme

Source

@carbon/import-once

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

Getting started

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

npm install -S @carbon/import-once

If you prefer Yarn, use the following command instead:

yarn add @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:

// a.scss
@import 'c';

// b.scss
@import 'c';

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

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

🙌 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.

Keywords

FAQs

Last updated on 25 Feb 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc