Visual Studio 2010: Publish minified javascript files instead of the original ones

Posted by salgiza on Stack Overflow See other posts from Stack Overflow or by salgiza
Published on 2010-03-02T16:13:55Z Indexed on 2010/04/15 7:23 UTC
Read the original article Hit count: 215

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,

© Stack Overflow or respective owner

Related posts about visual-studio-2010

Related posts about JavaScript