3.2.0

JavaScript Crunchinator

Hi Alex,

Which JavaScript Crunchinator you are using ?
Mflorek
January 21,
Nothing complicated here - I'm just removing whitespaces and linebreaks. Made with javascript as usual :-)
Alex (ActiveWidgets)
January 21,
Thanks
Mflorek
January 21,
Could you post your script for this please?
thanks
March 15,
Here is the function which removes spaces etc.

function fileCopy(source, target){
var s = source.readAll();

s = s.replace(/\/\*+([^*]+)\*+\//gm, ""); // remove /* */ comments
s = s.replace(/\/\/.*$/gm, ""); // remove // comments: attention!!! could be in regexp
s = s.replace(/\s+/gm, " "); //replace a consecutive spaces with one
s = s.replace(/\s*(=|\+|\?|\:|\{|\}|\(|\)|\,|\;)\s*/gm, "$1"); // remove more spaces
s = s.replace(/;\}/gm, "}"); // remove ; before }

target.write(s);
}
Alex (ActiveWidgets)
March 17,
Please provide short manual for use this script
Roman
August 22,

This topic is archived.

See also:


Back to support forum