fizker/minifier

Minifying an already minified script break the script.

Closed this issue · 6 comments

I like minifier because it seems to produce the smallest minified script, however it seems that when a minified script is minified again, it completely breaks. Are you aware of this issue? Fixable or a consequence of the algorithm used?

I have no idea what so ever, since I don't actually do the hard work.

https://www.npmjs.com/package/uglify-js is used for JavaScript, and https://www.npmjs.com/package/sqwish for CSS.

It might help to bump the versions, but it seems to be fairly minor bumps.

Aha! I see, that's odd because I remember when I tried out several different minifiers I found on npmjs.org this one produced significantly smaller output than uglify and a few others. Any idea why? Perhaps there are some more restrictive settings you can apply to uglify to get the same results but is more britle in terms of re-minifying?

Could be. It would make sense to expose more uglify-options, I suppose. I will look into that sometime during the weekend.

But honestly, I only use this module for CSS myself, as I have gone over to something like http://requirejs.org or http://browserify.org for JavaScript, and then I use uglify directly as part of that workflow.

k00k commented

Wouldn't it make sense to completely skip already minified files (.min.)?

It's not very flexible to base anything of a file extension, that would
lead to misattributing characteristics to files.

On Thu, May 28, 2015 at 2:51 PM Steve Babigian notifications@github.com
wrote:

Wouldn't it make sense to completely skip already minified files (.min.
)?


Reply to this email directly or view it on GitHub
#8 (comment).

k00k commented

@silverbucket I would agree, although in this case one must be pretty safe to assume it's pretty standard that files with .min.js or .min.css as they're extension are already minified. I guess I was thinking something a bit smarter. noticed the skip option. Maybe have that allow a regex to match .min.js or .min.css. Or something along those lines anyway.