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

2

16

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.

Donettedoney answered 22/11, 2012 at 5:50 Comment(1)
Right now we run minification scripts in MSBuild file in an "AfterBuild" target. But it non-ideal and really slows down build time (especially for unit tests).Pasteurization
Y
6

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

Yacov answered 22/11, 2012 at 5:53 Comment(1)
In my defense: OP edited his question, adding that comment after i answered it.Yacov
D
3

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

Dealt answered 22/11, 2012 at 5:52 Comment(3)
with minification can we minify it at publishing time ?Donettedoney
I think its done at runtime, i.e., when a request is made. You can enable caching of course.Dealt
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?Emunctory

© 2022 - 2024 — McMap. All rights reserved.