VSCodeMinify icon indicating copy to clipboard operation
VSCodeMinify copied to clipboard

Minify Directory on CSS goes on error: Minify Failed

Open entoz opened this issue 6 years ago • 7 comments

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.

entoz avatar Apr 12 '19 07:04 entoz

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.

millipedia avatar Apr 15 '19 13:04 millipedia

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

moosereeve avatar Apr 29 '19 15:04 moosereeve

@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

SebSob avatar May 09 '19 09:05 SebSob

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

LiteSoul avatar Jul 03 '19 20:07 LiteSoul

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 "..".

entoz avatar Jul 04 '19 05:07 entoz

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.

Ricoder92 avatar Aug 08 '20 22:08 Ricoder92

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

LupeBe avatar Dec 29 '20 15:12 LupeBe