79fbc58fc42e2ae372a1412334d2d579e17a6e483de717cbefc2cf354c3c72a3f7a7aac51530c767f3d516bde5d75a0722492343db605263249cffc722899d 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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";
  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. ## Development
  48. - `npm watch` will watch `src` for changes and rebuild
  49. - `npm autotest` will watch `src` and `test` for changes and retest
  50. ## License
  51. ISC
  52. ## With thanks
  53. - Mark Dalgleish
  54. - Tobias Koppers
  55. - Guy Bedford
  56. ---
  57. Glen Maddern, 2015.