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

Skip (re-)minification of already minified files, e.g. *.min.js and *.min.css #19

Open
adoerler opened this issue Oct 13, 2016 · 4 comments

Comments

@adoerler
Copy link

Hi,

this extension is awesome.

To speed things up, it would be great to skip files ending with .min.css or .min.js from running again through e.g. CssMin::minify.

Best thing would be to have this configurable per AssetBundle, but I'm not sure if this will be possible. On the other hand a regex (configurable in the assetsAutoCompress configuration array) could do the job.

What do you think?

Kind regards from Austria
Andreas

@skeeks-semenov
Copy link
Owner

@adoerler
You propose to add settings. Regular file name expression to pass, and do not handle. And just intact, adding to compress file?

@adoerler
Copy link
Author

Hi,

thank's for your fast response!

WP-Plugin Autoptimize has added such a feature in release 2.0 (https://tah.wordpress.org/plugins/autoptimize/faq/).

They state:

One of the bigger changes in Autoptimize 2.0 is that files that have "min.js" or "min.css" in their name are considered already minified and are only injected into the aggregated code after the actual minification, because this has an important performance-benefit. Although this has been tested rather thoroughly, it is possible that this approach does not always work. You can turn this behavior off by hooking into Autoptimize's API

I think one could profit from faster performance if source is already minified.
Additionally one could add exceptions for certain files if minification fails for unkown reasons.

Configuration could be an array of regular expressions, like:

cssFileCompressExceptions = [
'.min.css$',
'otherfile.css'
]

Andreas

@skeeks-semenov
Copy link
Owner

Additionally one could add exceptions for certain files if minification fails for unkown reasons.

I think this is the main reason why the need to make such a revision.

As is, in principle, once processing. And then all cached, and not very resource-intensive.
I'll try to do it later.

@adoerler
Copy link
Author

I think this is the main reason why the need to make such a revision.

you are right, this is also a very good reason having this configurable.
After adding Swiper (http://idangero.us/swiper/#.WACVrOiLSUk) as Asset the CSSMin component your are using failed due to parantheses in url data. This was a point where the stated functionality helped out. (On the other hand, the guys at Natxet have been very fast with fixing - natxet/CssMin#22 :-)

Andreas

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

No branches or pull requests

2 participants