0

I am having an issue with the following npm task that runs autoprefixer against a wildcard path:

"css:autoprefix": "postcss -u autoprefixer --autoprefixer.browsers \"Last 2 versions\" -r src/frontend/app/**/*.css"

The command works perfectly on windows but on my linux (jenkins build server, the css is not getting prefixed. Is it possible that linux isn't understanding the **/*.css in the command?

JRulle
  • 7,448
  • 6
  • 39
  • 61

1 Answers1

2

Is it possible that linux isn't understanding the **/*.css in the command?

You are exactly right.

This should work:

"css:autoprefix": "postcss -u autoprefixer --autoprefixer.browsers \"Last 2 versions\" -r \"src/frontend/app/**/*.css\""

Why this works:

Windows doesn't support globs at all, so it passes **/*.css directly to postcss, which expands it correctly.

Linux supports globs, but many distributions do not support the globstar (**) by default. The Linux shell attempts to expand the glob, but parses ** to mean *. That doesn't correctly expand it. By wrapping the glob in quotes, the glob will always be passed directly to postcss, which can expand it correctly.

RyanZim
  • 6,609
  • 1
  • 27
  • 43