added -m and -c options

This commit is contained in:
Mihai Bazon
2012-09-13 19:45:16 +03:00
parent d72c1d1293
commit 93b973c99d
2 changed files with 98 additions and 5 deletions

75
tmp/todo Normal file
View File

@@ -0,0 +1,75 @@
a = a + x ==> a+=x
*******
join consecutive var statements
*******
x == false ==> x == 0
x == true ==> x == 1
should warn too;
JS is so sloppy that this could be an indication of a bug.
*******
x, x ==> x
x = foo, x ==> x
other similar cases?
*******
Try to concatenate all scripts somehow before starting minification;
the issue will be keeping track of the current source file for
generating source maps. perhaps store that in the AST? Have a single
AST_Toplevel for all files.
XXX? Not sure if this is worth the trouble.
*******
discard spurious break statements
*******
for (...) {
if (foo) continue;
...
}
==>
for (...) {
if (!foo) { ... }
}
*******
The following seems to compress suboptimally. Should probably run more
passes somewhere.
function setOpacity(el, o) {
if (o != null) {
if (o == "" && o != 0) {
is_ie
? el.style.filter = ""
: el.style.opacity = "";
} else {
is_ie
? el.style.filter = "alpha(opacity=" + Math.round(o * 100) + ")"
: el.style.opacity = o;
}
return o;
} else {
if (!is_ie)
return parseFloat(el.style.opacity);
else
if (/alpha\(opacity=([0-9.])+\)/.test(el.style.opacity))
return parseFloat(RegExp.$1);
}
}
*******