google-code-export / wro4j

Automatically exported from code.google.com/p/wro4j
1 stars 1 forks source link

JsMinProcessor breaks the script after minimization #657

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When JsMinProcessor is applied on the following script:

var id = '' + ++idCounter;

the minimized script doesn't work anymore. 

Actual result:
var id=''+++idCounter;

Expected result:
var id=''+ ++idCounter;

Apparently jsMin doesn't respect the space preceded by pre increment operator. 

Original issue reported on code.google.com by alex.obj...@gmail.com on 20 Jan 2013 at 9:14

GoogleCodeExporter commented 9 years ago
I confirm, this processor breaks jQuery UI source.

Original comment by nurkiew...@gmail.com on 4 Feb 2013 at 12:46

GoogleCodeExporter commented 9 years ago
As a workaround for this issue, use a more stable minimizers like: 
googleClosure or dojoShrinksafe.

Original comment by alex.obj...@gmail.com on 4 Feb 2013 at 12:57

GoogleCodeExporter commented 9 years ago
I've tried to use already minimized js to workaround this:
<js minimize="false">/jquery-ui-1.9.2.custom.min.js</js>

with:
preProcessors=cssUrlRewriting,cssImport,cssMinJawr,semicolonAppender,consoleStri
pper
postProcessors=jsMin

but spaces are still trimmed.

Shouldn't jsMin not be applied when minimize="false"?

Original comment by lystoc...@gmail.com on 14 Feb 2013 at 2:05

GoogleCodeExporter commented 9 years ago
Minimize attribute does make sense for preprocessors  only.

after minimization

preProcessors=cssUrlRewriting,cssImport,cssMinJawr,semicolonAppender,consoleStri
pper

Original comment by alex.obj...@gmail.com on 14 Feb 2013 at 6:20

GoogleCodeExporter commented 9 years ago
Do you mean that I should place it in preProcessors

preProcessors=cssUrlRewriting,cssImport,cssMinJawr,semicolonAppender,consoleStri
pper,jsMin

so that minimize="false" will be applied then?

Is it correct place for jsMin? As in examples I see it usually in 
postProcessors.

Original comment by lystoc...@gmail.com on 14 Feb 2013 at 8:54

GoogleCodeExporter commented 9 years ago
It works as both: pre & post processor. If you want the minimize attribute to 
work as expected, use it as preprocessor.

Original comment by alex.obj...@gmail.com on 14 Feb 2013 at 9:04

GoogleCodeExporter commented 9 years ago
Will there be  any differences in performance if it is use in pre processor?

Original comment by lystoc...@gmail.com on 14 Feb 2013 at 9:28

GoogleCodeExporter commented 9 years ago
I have no benchmark for jsMin processor, but googleClosure processor performs 
faster when used as preProcessor. In other words, some processors are faster 
when processing smaller resource, than a big one. 

You can do this benchmark with jsMin. I expect no big difference, sicne jsMin 
is already pretty fast.

Original comment by alex.obj...@gmail.com on 14 Feb 2013 at 9:31