:: Forum >>

JavaScript Crunchinator

Hi Alex,

Which JavaScript Crunchinator you are using ?
Mflorek
Wednesday, January 21, 2004
Nothing complicated here - I'm just removing whitespaces and linebreaks. Made with javascript as usual :-)
Alex (ActiveWidgets)
Wednesday, January 21, 2004
Thanks
Mflorek
Wednesday, January 21, 2004
Could you post your script for this please?
thanks
Monday, March 15, 2004
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)
Wednesday, March 17, 2004
Please provide short manual for use this script
Roman
Monday, August 22, 2005

This topic is archived.


Back to support forum

Forum search