fmarcia / uglifycss

Port of YUI CSS Compressor from Java to NodeJS
MIT License
284 stars 37 forks source link

Url changed after mininfied #53

Closed Vasikaran closed 6 years ago

Vasikaran commented 7 years ago
// before minify
.profile{
   background:url("../images/profile.png") no-repeat scroll 0 0 transparent;
}

// after minify
.profile{
   background:url(___PRESERVED_TOKEN_1___) no-repeat scroll 0 0 transparent;
}

What is this? Is this a bug?

fmarcia commented 7 years ago

Thanks for your feedback. Yes, it looks like a bug. Could you please provide the input you used?

Vasikaran commented 7 years ago
let uglifyCss = require('uglifycss');

let css  = `.profile{
   background:url("../images/profile.png") no-repeat scroll 0 0 transparent;
}`;
let minifiedCss = uglifyCss.processString(css);

console.log(minifiedCss);

// output looks like
.profile{
   background:url(___PRESERVED_TOKEN_1___) no-repeat scroll 0 0 transparent;
}
jacobwindsor commented 6 years ago

I checked and cannot replicate this using the CLI. It works as expected.

// INPUT
.my-class {
    width: calc(100% + 30px);
    background:url("../images/profile.png") no-repeat scroll 0 0 transparent;
}

// OUTPUT
.my-class{width:calc(100% + 30px);background:url("../images/profile.png") no-repeat scroll 0 0 transparent}

Could be a bug only with the node API?

fmarcia commented 6 years ago

I can't reproduce this bug neither