minifier
minifier copied to clipboard
Quotation marks get removed from @font-face src urls causing problems with spaces in font names
@font-face {
font-family: 'Nexa Light';
src: url('font/Nexa Light.otf');
}
becomes
@font-face{font-family:'Nexa Light';src:url(font/Nexa Light.otf)}
It should be
@font-face{font-family:'Nexa Light';src:url('font/Nexa Light.otf')}
^^^^^^^^^^^^^^^^^^^^^
Interesting. You can work around the problem by replacing the space with %20, making your code @font-face{font-family:'Nexa Light';src:url(font/Nexa%20Light.otf)
I have the same problem, quotation marks get removed from css urls, when i change the output folder of the minified file, the paths change with it, so they can't be found at all:
.form {
background: #59cbcc url('../images/loginBG.jpg');
}
becomes
.form{background:#59cbcc url(../../../../../images/loginBG.jpg)}
@mik3009 That is not at all the same problem. Your problem is that you manually copy the image, but use the tool to copy the CSS. The tool keeps the relative path the same during the transformation, but you want it to be massively different post-transformation
Hi fizker, thanks for your reply. It still removes the quotations marks though, and why are quoted strings changed? I don't see this behaviour in js files either only in css, eventhough they are copied the same way.
See https://github.com/fizker/minifier#css-url-rewrites, which is slightly wrong because quotations are removed to save 2 bytes per URL (which breaks urls containing spaces)
I am pretty sure that strings in JS are also being changed, but probably just to normalise between ' and ". This behaviour ultimately depends on how uglify-js stringifies its AST
Ha thanks again for your swift reply, I'll read up on the rewrites.
edit: I changed the paths, so that'll be fine now, thanks for that.