Closed tssajo closed 7 years ago
In addition to the above: It also causes trouble if the path contains spaces. As you can see on the above screenshot, the original directory was "F:\Two Bad Mice..." So both the colon character after F is causing an invalid path and also the space after Two is making the path trimmed early as: "C:\WINDOWS\system32/F:/Two"
IMO the current working directory cannot just be concatenated with the source file's path at will. At least not on Windows.
@tssajo thanks for giving it a try - I'll try it locally on Windows and get back to you.
It's actually an API issue as well. Fix is coming!
I've just released 4.0.4 fixing handling spaces in paths, see ^ issue in API. Could you reinstall clean-css-cli and give it another try? It works fine on Windows 10 and Node 7 for me.
@jakubpawlowicz I do not know why you closed this when it is definitely still broken! And I cannot even re-open... :( Please re-open this issue! Thanks!
The "spaces in path" issue was a 2nd issue, that one you fixed and that's great.
But the main issue was not with the spaces in path! The main issue occurs when you try to use cleancss
on a file which is on a different driveletter than your current working directory.
For example:
You are here: C:\Windows\system32
and you issue the following command:
cleancss --skip-rebase -o "D:\Two Bad Mice\style.min.css" "D:\Two Bad Mice\style.css"
It still does not work! Please look at the result:
See how you incorrectly concatenate the path of the current working directory with the specified file's path? This is the problem:
C:/Windows/system32/D:/Two Bad Mice/style.css
Why the concatenation??? The file is NOT under the current working directory, it is under a different driveletter ( under drive D: )
BTW, this concatenated path is invalid on Windows, because a directory path cannot have a colon character in it.
This is the issue I originally reported here. Not handling spaces in paths properly was just an additional issue (maybe I should have reported that as a separate issue).
@tssajo I closed it because I tested the new version locally and it worked fine, see my local output on Node 7 and Win 10.
If it's not fixed we can reopen this issue, however, I don't see it happening anymore.
Oh, scratch that. I can see it still happens when rebasing is used via --output
flag.
@jakubpawlowicz Thanks for your answer!
So it was the output ( -o
) flag then. Good to know!
I'll try your updated version of clean-css
tomorrow. Thanks, again!
So this should be fixed in 4.0.5. Works fine locally with -o
option.
I can confirm that the issue has been fixed with version 4.0.5
Thank you!
That's great 👍
Hello @jakubpawlowicz , I'm having problems with clean-css-li version 4.1.11. I use Windows 10 64 bits and my files .css not be minified. You said that the problem was fixed in version 4.0.5, but it continues. The error that occurs is the same one mentioned by tssajo. You can help me?
If you are on the Windows platform and the CSS file you are trying to minify is on a different drive letter, e.g.: drive F: instead of the default drive C: and you attempt to run the
cleancss
command with an absolute path pointing to the input file (as well as an absolute path to the output file) then clean-css-cli is trying to import something from an invalid path, see:A directory or file name on Windows cannot contain the colon ( : ) character!
This issue is originally surfaced here: https://github.com/tssajo/Minify/issues/51
This is a regression introduced in clean-css-cli.
clean-css 3.x.x in the same situation worked just fine.