Automatically minify JavaScript files at the time of Publishing website in Visual Studio 2010 or 2012?

15,128

Solution 1

Use MVC 4. It bundles multiple scripts and minifies them.

Solution 2

You can take a look at bundling and minification if you are using ASP.NET 4.5.

Share:
15,128
Rahul
Author by

Rahul

Updated on June 18, 2022

Comments

  • Rahul
    Rahul about 2 years

    Is there any way in VS 2010 or 2012 to minify JavaScript files at the time of Publishing?

    I want automatically minified js files. Any good example for compression?

    Please note that I am not using MVC.

  • Rahul
    Rahul over 11 years
    with minification can we minify it at publishing time ?
  • Sidharth Mudgal
    Sidharth Mudgal over 11 years
    I think its done at runtime, i.e., when a request is made. You can enable caching of course.
  • Matt Wilson
    Matt Wilson over 11 years
    Are there any (automated) ways of using ASP.NET bundling and minification without deploying the un-minified javascripts? For example, it may be fine for this to be done at runtime when the web application is being deployed your own server, but what if you are releasing a version for others to deploy onto their own intranet / server etc. and you don't want to include source?
  • Jeroen
    Jeroen over 11 years
    In my defense: OP edited his question, adding that comment after i answered it.