Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS minification/aggregation breaks percent measures #140

Open
nicStuff opened this issue Mar 29, 2017 · 8 comments
Open

CSS minification/aggregation breaks percent measures #140

nicStuff opened this issue Mar 29, 2017 · 8 comments
Labels

Comments

@nicStuff
Copy link

With version 1.7.6, and the following configuration

{ "bundles": [ { "type": "css", "name": "aaa.css", "files": [ "percent.css" ] } ] }

And the file percent.css being body { font-family:Arial, Helvetica, sans-serif; font-size:75.0%; color:#000; background:#cdcdcd; }

the resulting file "aaa.css" is body{font-family:Arial,Helvetica,sans-serif;font-size:75.0;color:#000;background:#cdcdcd}.

The percent sign has been lost in the process.

@nicStuff nicStuff changed the title CSS minification/aggregation brakes percent measures CSS minification/aggregation breaks percent measures Mar 29, 2017
@nicStuff
Copy link
Author

A quick look on the source code doesn't reveal problems to me. Maybe this depends on YUI compressor yui/yuicompressor#132

@samaxes
Copy link
Owner

samaxes commented Mar 29, 2017

Yes, it's probably related to a YUI Compressor bug.
Switching to Closure Compiler should fix your issue, can you please try?

@nicStuff
Copy link
Author

nicStuff commented Mar 29, 2017

By setting <cssEngine>CLOSURE</cssEngine> (it's the CSS the one involved) the final file is empty: this doesn't surprise me since in https://github.com/samaxes/minify-maven-plugin/blob/master/src/main/java/com/samaxes/maven/minify/plugin/ProcessCSSFilesTask.java the YUI compressor engine is the only one taken into account.

Anyway, I compiled the plugin after having changed the artifact com.yahoo.platform.yui-yuicompressor to the version 2.4.7 and the output is right. Furthermore, YUI compressor 2.4.7 has always worked well for me, since I've been using https://github.com/davidB/yuicompressor-maven-plugin/ for years, which uses that version (but your plugin gives the flexibility needed for creating css/js groups).

So, is it reasonable to go back to 2.4.7? Are there any options available only in 2.4.8 that this plugin uses?

@nicStuff
Copy link
Author

I've created pull request #141

@samaxes
Copy link
Owner

samaxes commented Mar 29, 2017

The problem is that I got asked to update to version 1.4.8 to support the latest JavaScript versions which YUI compressor 2.4.7 do not support.
I would prefer if you can ask the YUI compressor team to release a new version with mentioned bug fixed. Then we can update the plugin to use that version.

@nicStuff
Copy link
Author

It looks like the official YUI is no longer mantained by looking at the status of recent open issues (https://github.com/yui/yuicompressor/issues): the last one has been resolved on october 2016. Besides the issues, the last release is from 4 years ago, a lot of time.

Would it be viable to enable the closure engine for CSS and disable YUI? This way you could keep YUI 2.4.8 for javascript and the closure engine only for CSS.

@samaxes
Copy link
Owner

samaxes commented Mar 30, 2017

I tried that in the past, but there's a lot of work involved: google/closure-stylesheets#101
Are you interested in helping?

@nicStuff
Copy link
Author

nicStuff commented Mar 30, 2017

Sure interested, but I wouldn't be able to give it the adequate time and effort to obtain a robust result. I'm just delaying the use of this plugin for seeing if we find a simple and quick and good solution: if we don't, I will simply use the version I installed locally in which I use YUI 2.4.7.

The point is that I really like this plugin and would like that CSS compression gets really resolved somehow. We could wrap the YUI 2.4.7 (or the bleeding edge of YUI or the commit that resolves that issue) in a new CSS compression engine, then use that engine here; we could take another CSS compression engine available on the market, but I struggle a bit to find one (this means that if it exists it's something not that tested/used, so something unreliable).

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants