1 | # CSS Modules: Extract Imports
|
2 |
|
3 | [![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)
|
4 |
|
5 | Transforms:
|
6 |
|
7 | ```css
|
8 | :local(.continueButton) {
|
9 | composes: button from "library/button.css";
|
10 | color: green;
|
11 | }
|
12 | ```
|
13 |
|
14 | into:
|
15 |
|
16 | ```css
|
17 | :import("library/button.css") {
|
18 | button: __tmp_487387465fczSDGHSABb;
|
19 | }
|
20 | :local(.continueButton) {
|
21 | composes: __tmp_487387465fczSDGHSABb;
|
22 | color: green;
|
23 | }
|
24 | ```
|
25 |
|
26 | ## Specification
|
27 |
|
28 | - Only a certain whitelist of properties are inspected. Currently, that whitelist is `['composes']` alone.
|
29 | - An extend-import has the following format:
|
30 |
|
31 | ```
|
32 | composes: className [... className] from "path/to/file.css";
|
33 | ```
|
34 |
|
35 | ## Options
|
36 |
|
37 | - `failOnWrongOrder` `bool` generates exception for unpredictable imports order.
|
38 |
|
39 | ```css
|
40 | .aa {
|
41 | composes: b from "./b.css";
|
42 | composes: c from "./c.css";
|
43 | }
|
44 |
|
45 | .bb {
|
46 | /* "b.css" should be before "c.css" in this case */
|
47 | composes: c from "./c.css";
|
48 | composes: b from "./b.css";
|
49 | }
|
50 | ```
|
51 |
|
52 | ## Building
|
53 |
|
54 | ```
|
55 | npm install
|
56 | npm test
|
57 | ```
|
58 |
|
59 | [![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)
|
60 |
|
61 | - 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)
|
62 | - 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)
|
63 |
|
64 | ## License
|
65 |
|
66 | ISC
|
67 |
|
68 | ## With thanks
|
69 |
|
70 | - Mark Dalgleish
|
71 | - Tobias Koppers
|
72 | - Guy Bedford
|
73 |
|
74 | ---
|
75 |
|
76 | Glen Maddern, 2015.
|