In my javascript I have some bits of code specifically used for debugging which I don't want to include in the live site. Is there a way I can semi-ment these bits of code so that they run as javascript normally, but that yui pressor thinks they're ments and removes them?
For example
for(key in modules) {
try {
MyApp[key].init(modules[key].params);
} catch (e) {
console.log("Module " + key + " threw an error");
break;
}
}
I would like to be able to ment out the console.log bit automatically when pressing to deploy to the live site. So maybe wrap the code in something like
//yuiIgnore
console.log("Module " + key + " threw an error");
//endyuiIgnore
In my javascript I have some bits of code specifically used for debugging which I don't want to include in the live site. Is there a way I can semi-ment these bits of code so that they run as javascript normally, but that yui pressor thinks they're ments and removes them?
For example
for(key in modules) {
try {
MyApp[key].init(modules[key].params);
} catch (e) {
console.log("Module " + key + " threw an error");
break;
}
}
I would like to be able to ment out the console.log bit automatically when pressing to deploy to the live site. So maybe wrap the code in something like
//yuiIgnore
console.log("Module " + key + " threw an error");
//endyuiIgnore
Share
Improve this question
edited Sep 27, 2010 at 10:09
wheresrhys
asked May 13, 2010 at 10:30
wheresrhyswheresrhys
23.6k21 gold badges97 silver badges165 bronze badges
1
- Can you please provide a sample of the code you're trying to minify BUT is not getting stripped out. Secondly, can you please provide the mand line you run to minify or the configuration settings (if you're using the .NET port). – Pure.Krome Commented Sep 24, 2010 at 12:23
1 Answer
Reset to default 8With regard specifically to console.log
statements:
I'm using sed
to replace "console"
with "//console"
before launching the pressor:
sed -e "s/console/\/\/console/g" originalWithConsoleStatements.js > noConsoleStatements.js
This statement sits inside a shell script which then launches the pressor.