postcss / postcss-cli

CLI for postcss
Other
836 stars 93 forks source link

Use 'slash' on input files before globbing to support absolute paths with backslashes on Windows #355

Closed matthias-christen closed 3 years ago

matthias-christen commented 3 years ago

globby (used to glob input arguments to postcss-cli) only supports forward slashes. In order to be able to provide absolute paths containing backslashes to the CLI on Windows, they need to be converted to forward slashes, otherwise postcss-cli terminates with the error message 'Input Error: You must pass a valid list of files to parse'.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.1%) to 82.237% when pulling a0d4fb009c07831a692191b3f1b0a357eba1ce91 on matthias-christen:master into c94c1885a97f30627ba31c386fce0d8eed483a71 on postcss:master.

RyanZim commented 3 years ago

Forgive me for my ignorance (I've never actually run postcss on Windows), but why can't you just pass paths with forward slashes from the CLI?

matthias-christen commented 3 years ago

@RyanZim, on Windows, the natural directory separator is a backslash. For instance, if you tab-autocomplete a path in a Windows command line, it will convert forward slashes to backslashes. So, in particular for a command line tool, I think it is important to accept paths in the system's standard format. What is really confusing currently: if you supply a (seemingly) perfectly valid absolute path to postcss, you'll get the error message "Input Error: You must pass a valid list of files to parse". I guess you could also adjust the error message that the user must enter forward slashes, but why not just do it right when the fix is so simple.

RyanZim commented 3 years ago

Will try to release this later this week.

RyanZim commented 3 years ago

Eh, that was a bit longer than a week. Regardless, published in v8.2.0. :rocket: