views:

121

answers:

1

I'm in the initial stages of investigating JSCompress for MSBUILD : http://msbuildtasks.tigris.org/

For my initial testing I have a few JS files over which I am running this task, some of the files include already minified JS files (JQuery Library etc..) and some files contain Special characters.

When the task runs everytime it encounters a special character in JS file it throws an error on the screen. How should I overcome this error so that it ignores special characters.

I do not want to exclude any files on the basis of wildcard on filenames (e.g. *\jquery.js) since a developer can use the name as part of some other JS file which will then get excluded without minifying.

Is there a way to achieve this or should I be looking at other tools ? Thanks !

A: 

Use the replace method to replace the special characters with a character entity of your own creation. Then after you have evaluated all the code use the replace method again to revert the special character conversion. I found I had to do this in my Pretty Diff tool because JavaScript cannot evaluate the difference between single and double quotes passed as string literals.