Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

postcss-modules-extract-imports

css-modules52.9mISC3.1.0TypeScript support: definitely-typed

A CSS Modules transform to extract local aliases for inline imports

css-modules, postcss, plugin

readme

CSS Modules: Extract Imports

Build Status

Transforms:

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

into:

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

  • Lines: Coverage Status
  • Statements: codecov.io

License

ISC

With thanks

  • Mark Dalgleish
  • Tobias Koppers
  • Guy Bedford

Glen Maddern, 2015.

changelog

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

3.1.0 - 2024-04-03

Features

  • support multiple composes, i.e. .class { composes: a b, c, e d from global, f g from "./file.css"; }

3.0.0 - 2020-10-13

Fixes

  • compatibility with plugins other plugins

3.0.0-rc.3 - 2020-10-11

Fixes

  • broken release

3.0.0-rc.2 - 2020-10-08

BREAKING CHANGE

  • minimum supported postcss version is ^8.1.0

Fixes

  • minimum supported Node.js version is ^10 || ^12 || >= 14
  • compatibility with other plugins
  • compatibility with PostCSS 8

3.0.0-rc.1 - 2020-09-18

Fixes

  • avoid using postcss directly for new rules and decls

3.0.0-rc.0 - 2020-09-18

BREAKING CHANGE

  • minimum supported Node.js version is >= 10.13.0 || >= 12.13.0 || >= 14
  • minimum supported postcss version is ^8.0.3
  • postcss was moved to peerDependencies, you need to install postcss in your project before use the plugin