postcss/postcss-import

Import all files from a directory

fcordillot opened this issue · 1 comments

Hi!
I use your plugin to import all my CSS files.
I set it up at first but would like to modify it now to make it more practical.

Actually I have to import ALL the CSS file:

@import "path/to/file1.css";
@import "path/to/file2.css";
@import "path/to/file3.css";
...

And when I want to use:

@import "./**/*.css";

I have an error : Error: Failed to find './**/*.css'

Here is my postcss.config.js:

const plugins = {
  'postcss-import': {},
  'tailwindcss/nesting': 'postcss-nesting',
  tailwindcss: {},
  autoprefixer: {}
}

if (process.env.NODE_ENV === 'production') {
  plugins['cssnano'] = {
    preset: 'default',
  }
}

module.exports = {
  syntax: 'postcss-scss',
  plugins
}

And this is my NPM scripts : dev:css: "NODE_ENV=dev postcss ./css_tw/style.css -o ./dist/styles/style.min.css --watch"

postcss-import does not support importing globs. CSS is order-dependent, so importing globs doesn't work reliably, since there's no way to determine which order the files should be imported in.