postcss / postcss-cli

CLI for postcss
Other
840 stars 93 forks source link

Glob pattern example not working as expected #271

Closed kate-hall closed 4 years ago

kate-hall commented 5 years ago

My issue is similar to the one described here: https://github.com/stylelint/stylelint/issues/1970

The glob pattern only outputs files from the top level or one level deep. Any further nested items are skipped.

My usage is as follows:

postcss src/styles/**/*.css -d ./dist -u autoprefixer

This will output the following files:

src/styles/style.css > dist/style.css
src/styles/one/one.css > dist/a.css
src/styles/two/two.css > dist/b.css
src/styles/three/a/three-a.css > ??? missing
src/styles/three/b/three-b.css > ??? missing

If I surround the glob pattern with single quotes, I get ALL nested subdirectories no matter how deep, but none of the files at the root level.

postcss 'src/styles/**/*.css' -d ./dist -u autoprefixer

Now outputs the following files:

src/styles/style.css > ??? missing
src/styles/one/one.css > dist/a.css
src/styles/two/two.css > dist/b.css
src/styles/three/a/three-a.css > dist/three-a.css
src/styles/three/b/three-b.css > dist/three-b.css

Any idea of how to fix this without writing two commands to catch the root files? I'm using v6.1.2.

kate-hall commented 5 years ago

Update: glob seems to work in quotes at the root level if I use the --replace flag instead of a different directory.

RyanZim commented 5 years ago

You can pass as many globs as needed in a single command, like postcss foo/*.css bar/*.css. Does that help?

jinzhubaofu commented 4 years ago

Any update of this issue?

RyanZim commented 4 years ago

Closing for lack of response.