You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.8 KiB

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