postcss-partial-import icon indicating copy to clipboard operation
postcss-partial-import copied to clipboard

[Feature Request] Support a package.json base directory as the root location of css files

Open oleersoy opened this issue 8 years ago • 0 comments

I'm publishing pure css modules like these:

  • https://superflycss.github.io/utilities-layout/target/test/html/
  • https://superflycss.github.io/utilities-colors/target/test/html/
  • https://superflycss.github.io/utilities-icons/target/test/html/

The main attribute on package.json resolves the import currently via main: src/main/css/index.css. The postcss-import plugin can also import sub modules with import statements like this:

@import "@superflycss/utilities-layout/src/main/css/faucet.css";

Ideally the main attribute could be set to a directory like src/main/css (With functionality similar to the <base> html element) and this would be the base directory for all module imports. The above statement could then be shortened to:

@import "@superflycss/utilities-layout/faucet.css";

So in other words if we want the entire kitchen sink (index.css) then we do:

@import "@superflycss/utilities-layout";

But if we only want faucet.css or perhaps just a washer that goes to the faucet then we do:

@import "@superflycss/utilities-layout/faucet.css";

or

@import "@superflycss/utilities-layout/faucet/washer.css";

Does postcss-partial-import support this? Would this project be interested in supporting it? Here's a link to the original uncss issue that made this important: Uncss causes infinite loop

oleersoy avatar Oct 26 '17 14:10 oleersoy