rspivak / slimit

SlimIt - a JavaScript minifier/parser in Python
MIT License
551 stars 94 forks source link

for loop minification #50

Closed chrisdl closed 11 years ago

chrisdl commented 11 years ago

Assigning the iterating variable before the loop causes issue in minification

var i = 0;
for (i; i < 5; i++) {
    // Do something
}
// Outputs: var i=0;for(ii<5;i++){} (broken)

var i;
for (i = 0; i < 5; i++) {
    // Do something
}
// Outputs: var i;for(i=0;i<5;i++){} (correct)
rspivak commented 11 years ago

What version of slimit did you run?

chrisdl commented 11 years ago

slimit==0.7.4

(It is the one that is downloaded with pip install slimit)

rspivak commented 11 years ago

That issues was fixed in https://github.com/rspivak/slimit/issues/37 If you try slimit 0.8.1, you should be OK.

chrisdl commented 11 years ago

Awesome thanks!

rspivak commented 11 years ago

You're welcome :)