marvin-zhao / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

JSMin and JSMinPlus don't remove inline comment while minifying #308

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify commit/version: jsmin 1.1.2 and jsmin+ 1.4
PHP version: 5.4

I use the module https://github.com/OpenBuildings/asset-merger/issues/27 to 
merge and minify my assets with the PHP framework Kohana 3.3.

This modules uses JsMin and JsMinPlus to minify the JS files.
But when I enable the production environment, the minified files contains 
`inline comments` that breaks everything. I don't get it. The module use the 
1.1.1 and 1.3 versions, I upgraded my project with the latest but still the 
same. I just don't understand why the inline comment are not removed before 
minifying everything on the same line, it doesn't make sense.

Is there any workaround here? I started remove inline comments but ... No 
thanks.

Thanks for any help.

Original issue reported on code.google.com by ambroise...@gmail.com on 5 Apr 2014 at 11:43

GoogleCodeExporter commented 9 years ago
JSMin should remove comments unless they have IE conditionals. This does not 
look like JSMin output. Closing for now.

Original comment by mrclay....@gmail.com on 7 Apr 2014 at 3:09

GoogleCodeExporter commented 9 years ago
Actually, I just saw that on some files the comments are removed. But at a 
certain point there are not removed anymore. Could that be because of the size 
of the generated file ? (1.5M chars) or a memory issue ?

Original comment by ambroise...@gmail.com on 7 Apr 2014 at 6:09

GoogleCodeExporter commented 9 years ago
Please reopen this issue.

I searched more about it I'm sure it's because either of the size of the 
generated file or a memory issue.

Anyway, it's basically because there are too much big files to process.
If I import all my files:
https://gist.githubusercontent.com/Vadorequest/10422717/raw/636fdd6c377424dbc9ba
ea86a76217a4f240fc7f/default.js

If I import just a few libraries:
https://gist.github.com/Vadorequest/10422779

Please search for "fancybox/jquery-fancybox-thumbs.js" and compare between both 
files. You'll see that on the big one there are comments and on the small they 
are deleted. It's exactly the same code who generate both files, excepts that 
on the secnd case I don't add the theme assets neither the whole asset folder.

Please help me to figure out how I can generate file that doesn't contain slash 
comments, is it a memory allocation problem?

Original comment by ambroise...@gmail.com on 10 Apr 2014 at 9:01

GoogleCodeExporter commented 9 years ago
If memory were the issue PHP would exit and nothing would be written to cache. 
I don't know how OpenBuildings has integrated these class files, you need to 
ask them.

JSMin and JSMinPlus absolutely do remove comments appropriately.

Original comment by mrclay....@gmail.com on 10 Apr 2014 at 9:15

GoogleCodeExporter commented 9 years ago
I'm sory, but what's the link with `OpenBuildings`?
I don't know what you are refering to.
Thanks.

Original comment by ambroise...@gmail.com on 10 Apr 2014 at 9:25

GoogleCodeExporter commented 9 years ago
Okay. I get it. The point is that I didn't get any answer from them since I got 
into this issue...

Original comment by ambroise...@gmail.com on 10 Apr 2014 at 9:32

GoogleCodeExporter commented 9 years ago
I can't support their software.

Original comment by mrclay....@gmail.com on 10 Apr 2014 at 9:42

GoogleCodeExporter commented 9 years ago
I'm not asking you to. I'll move to use another soft then, maybe 
https://code.google.com/p/minify/wiki/CustomSource, I should not have issue 
with this one. Maybe do you know something better? (I use Kohana PHP framework 
3.3)

Original comment by ambroise...@gmail.com on 10 Apr 2014 at 9:46