# @carbon/import-once

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

Latest version **10.7.0** (published 2022-02-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @carbon/import-once
pnpm add @carbon/import-once
yarn add @carbon/import-once
bun add @carbon/import-once
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 10.7.0 |
| Published | 2022-02-25 |
| First published | 2018-11-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9621 |
| Maintainers | abbeyhrt, dcwarwick, jdharvey, carbon-design-system, joshblack, carbon-bot, tjegan, alisonjoseph, adavila, shinytoyrobots, magedhennawy, leechase, vpicone, dakahn, jnm2377, jeffreychew, simonfinney, sstrubberg, andreancardona, tay1orjones |
| Keywords | eyeglass-module, ibm, elements, carbon, carbon-elements, carbon-design-system, components, react |

## Links

- npm: https://www.npmjs.com/package/@carbon/import-once
- Repository: https://github.com/carbon-design-system/carbon
- Homepage: https://github.com/carbon-design-system/carbon#readme
- Issues: https://github.com/carbon-design-system/carbon/issues
- npm.io page: https://npm.io/package/@carbon/import-once

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 10.7.0 (latest) — 2022-02-25
- 10.7.3 (v10-next) — 2025-05-14
- 10.5.0-alpha.0 (nightly) — 2020-12-03
- 10.4.0-alpha.5518 (canary) — 2019-07-15
- 0.0.1-beta.5 (beta) — 2019-03-25
- 0.0.1-alpha.32 (alpha) — 2019-02-12
- 10.7.2 — 2024-05-08
- 10.7.1 — 2024-03-11
- 10.7.0-rc.0 — 2022-02-22
- 10.6.0 — 2021-02-04
- 10.5.0 — 2021-01-25
- 10.5.0-rc.0 — 2021-01-20
- 10.4.0 — 2020-12-03
- 10.4.0-rc.0 — 2020-11-19
- 10.4.0-alpha.6542 — 2020-03-16
- … 78 more at https://npm.io/package/@carbon/import-once/versions

## README

# @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](https://www.npmjs.com/):

```bash
npm install -S @carbon/import-once
```

If you prefer [Yarn](https://yarnpkg.com/en/), use the following command
instead:

```bash
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:

```scss
// 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](/.github/CONTRIBUTING.md)! 👀

## 📝 License

Licensed under the [Apache 2.0 License](/LICENSE).

---
_Source: https://npm.io/package/@carbon/import-once · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
