HookyQR / VSCodeMinify

Add minify function to VSCode 0.10+
53 stars 20 forks source link

Minify Directory on CSS goes on error: Minify Failed #41

Open entoz opened 5 years ago

entoz commented 5 years ago

Hello,

I have an issue on a minifying directory with CSS files on Windows 10 with VSCode 1.33.1.

It goes on error: "Minify failed: 2 error(s).

It works on JS and single CSS files.

millipedia commented 5 years ago

I also have this problem on macOS 10.14.4 with VSCode 1.33.1.

Trying to minify a directory with even a single css file in will result in a failure with "Minify failed: 1 error(s)". The number of errors is just the number of css files in the directory.

Directories that previously worked fine no longer minify. This possibly happened after upgrading to 10.14.4 but I'm not 100% sure.

If I dump the error to console at about line 178 of extension.js I get:

"Ignoring local @import of "css/test.css" as resource is missing."

however .... if I just comment out the line at 168 of extension.js that is removing the absolute file path:

// files = files.map(f => f.replace(settings.css.root, ""));

then everything works fine. The directory is minified with no errors.

No idea why we need to keep the absolute path now but hope that's some help. Let me know if I can provide any more info.

s.

moosereeve commented 5 years ago

Same on Windows 10 VSCode 1.33.1. Commenting out line 168 worked for me as well

SebSob commented 5 years ago

@millipedia @reevet - How do you modify the source code extension.js ? Where is this file located?

EDIT: For windows it's in: C:\Users\<user>\.vscode\extensions\hookyqr.minify-0.4.3

LiteSoul commented 5 years ago

I'm having the same error, and commenting out that line solved it. Although we need a permanent solution

entoz commented 5 years ago

Commenting out that line solves the problem, but there is another issue. In the minified file paths would be incorrect.

for example

If you have CSS like this: background-image: url(../images/bill.png);

In output file would be like this: background-image:url(d:/Projects/test/styles/images/bill.png);

So, then you must replace in the outputted file all "d:/Projects/test/styles" with "..".

Ricoder92 commented 4 years ago

Commenting out that line solves the problem, but there is another issue. In the minified file paths would be incorrect.

for example

If you have CSS like this: background-image: url(../images/bill.png);

In output file would be like this: background-image:url(d:/Projects/test/styles/images/bill.png);

So, then you must replace in the outputted file all "d:/Projects/test/styles" with "..".

Just set the setting "rebase" to false. Thats should fix that.

LupeBe commented 3 years ago

A little bit late, but anyhow ... Replacing the deprecated "rootPath" property (extension.js, lines 96 and 166) with "workspaceFolder" fixed it for me.