Visual Studio 2010: Publish minified javascript files instead of the original ones
- by salgiza
I have a Scripts folder, that includes all the .js files used in the project. Using the Ajax Minifier task, I generate .min.js files for each one.
Depending on whether the application is running in debug or release mode, I include the original .js file, or the minified one.
The Scripts folder looks like this:
Scripts/script1.js
Scripts/script1.min.js // Outside the project, generated automatically on build
Scripts/script2.js
Scripts/script2.min.js // Outside the project, generated automatically on build
The .min.js files are outside the project (although in the same folder as the original files), and they are not copied into the destination folder when we publish the project.
I have no experience whatsoever using build tasks (well, apart from including the minifier task), so I would appreciate if anyone could advise me as to which would be the correct way to:
Copy the .min.js files to the destination folder when I publish the app from Visual Studio.
Delete / Not copy the original js files (this is not vital, but I'd rather not copy files that will not be used in the app).
Thanks,