postcss-modules-resolve-path

1.0.0 • Public • Published

CSS Modules: Search paths to resolve compose directives

Build Status NPM version

With this config:

{
  'paths': [ 'src/style', 'components/style' ]
}

given two files: 'src/style/base.css' and 'components/style/button.css:

.myClass {
  composes: button from "button.css";
  color: green;
}

into:

.myClass {
  composes: button from "components/style/button.css";
  color: green;
}

It will ignore absolute and relative paths, so:

.myClass {
  composes: button from "button.css";
  color: green;
}
 
.myClass2 {
  composes: button from "/button.css";
  color: green;
}
 
 
.myClass3 {
  composes: button from "./button.css";
  color: green;
}

will still be:

.myClass {
  composes: button from "components/style/button.css";
  color: green;
}
 
.myClass2 {
  composes: button from "/button.css";
  color: green;
}
 
 
.myClass3 {
  composes: button from "./button.css";
  color: green;
}

Options

  • paths - array of search paths

Building

npm install
npm build
npm test

Development

  • npm watch will watch src for changes and rebuild
  • npm autotest will watch src and test for changes and retest

License

MIT

Package Sidebar

Install

npm i postcss-modules-resolve-path

Weekly Downloads

483

Version

1.0.0

License

MIT

Last publish

Collaborators

  • madpilot