# postcss-modules-extract-imports

> A CSS Modules transform to extract local aliases for inline imports

Latest version **3.1.0** (published 2024-04-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install postcss-modules-extract-imports
pnpm add postcss-modules-extract-imports
yarn add postcss-modules-extract-imports
bun add postcss-modules-extract-imports
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2024-04-03 |
| First published | 2015-05-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/postcss-modules-extract-imports) |
| Module format | CommonJS |
| Node | ^10 \|\| ^12 \|\| >= 14 |
| Dependencies | 0 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 41 |
| Author | Glen Maddern |
| Maintainers | markdalgleish, sokra, geelen, evilebottnawi |
| Keywords | css-modules, postcss, plugin |

## Links

- npm: https://www.npmjs.com/package/postcss-modules-extract-imports
- Repository: https://github.com/css-modules/postcss-modules-extract-imports
- Issues: https://github.com/css-modules/postcss-modules-extract-imports/issues
- npm.io page: https://npm.io/package/postcss-modules-extract-imports

## Recent versions

- 3.1.0 (latest) — 2024-04-03
- 3.0.0-rc.3 (next) — 2020-10-11
- 1.0.0-beta1 (beta) — 2015-08-15
- 3.0.0 — 2020-10-13
- 3.0.0-rc.1 — 2020-09-22
- 3.0.0-rc.0 — 2020-09-21
- 2.0.0 — 2018-10-30
- 1.2.1 — 2018-10-30
- 1.2.0 — 2017-05-22
- 1.1.0 — 2017-05-21
- 1.0.1 — 2016-05-12
- 1.0.0 — 2015-10-21
- 1.0.0-beta2 — 2015-09-19
- 0.0.6 — 2015-09-13
- 0.0.5 — 2015-06-18
- … 4 more at https://npm.io/package/postcss-modules-extract-imports/versions

## README

# CSS Modules: Extract Imports

[![Build Status](https://travis-ci.org/css-modules/postcss-modules-extract-imports.svg?branch=master)](https://travis-ci.org/css-modules/postcss-modules-extract-imports)

Transforms:

```css
:local(.continueButton) {
  composes: button from "library/button.css";
  color: green;
}
```

into:

```css
:import("library/button.css") {
  button: __tmp_487387465fczSDGHSABb;
}
:local(.continueButton) {
  composes: __tmp_487387465fczSDGHSABb;
  color: green;
}
```

## Specification

- Only a certain whitelist of properties are inspected. Currently, that whitelist is `['composes']` alone.
- An extend-import has the following format:

```
composes: className [... className] from "path/to/file.css",  className [... className], className [... className] from global;
```

## Options

- `failOnWrongOrder` `bool` generates exception for unpredictable imports order.

```css
.aa {
  composes: b from "./b.css";
  composes: c from "./c.css";
}

.bb {
  /* "b.css" should be before "c.css" in this case */
  composes: c from "./c.css";
  composes: b from "./b.css";
}
```

## Building

```
npm install
npm test
```

[![Build Status](https://travis-ci.org/css-modules/postcss-modules-extract-imports.svg?branch=master)](https://travis-ci.org/css-modules/postcss-modules-extract-imports)

- Lines: [![Coverage Status](https://coveralls.io/repos/css-modules/postcss-modules-extract-imports/badge.svg?branch=master)](https://coveralls.io/r/css-modules/postcss-modules-extract-imports?branch=master)
- Statements: [![codecov.io](http://codecov.io/github/css-modules/postcss-modules-extract-imports/coverage.svg?branch=master)](http://codecov.io/github/css-modules/postcss-modules-extract-imports?branch=master)

## License

ISC

## With thanks

- Mark Dalgleish
- Tobias Koppers
- Guy Bedford

---

Glen Maddern, 2015.

---
_Source: https://npm.io/package/postcss-modules-extract-imports · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
