How to minify JavaScript files that contains a function name separated with a '.'? -
i minfying 100's of javascript files on windows os , ran issue half of them. turns out minfiying compressor cannot minify js files has function spearated dot. yui compressor deletes contents of file when such situation happens, , ajaxminifier, ignores dot , take function name before it.
example of function in question:
function window.onload() {} error message: :missing ( before function parameters using yui compressor msbuild task , command line both yeild same results.
command line example:
java -jar yuicompressor.jar --type js --charset utf-8 -o d:\foo.js d:\foo-min.js using ajax minifier example:
command line:
ajaxmin.exe -o d:\foo.js d:\foo-min.js however, 1 solution rewrite function , minification process works great example:
window.onload = function() {} but not option us, right now. know problem , able provide solution?
thanks. yes, did inherit these files , yet determine why written way. dont believe there processor converts proper js..i know web app runs on ie, may reason why working. on firefox etc, may not case.i looking changed
it's breaking because you're trying minify invalid javascript. functions cannot have dots in them.
i think you're trying namespace. if are, better off doing like:
var myvar = { foo: function () { /* */ } } myvar.foo();
Comments
Post a Comment