Script Minification and Continuous Integration with MSBuild

后端 未结 3 1384
被撕碎了的回忆
被撕碎了的回忆 2021-02-01 06:42

On a recent project I have been working on in C#/ASP.NET I have some fairly complicated JavaScript files and some nifty Style Sheets. As these script resources grow in size it

3条回答
  •  灰色年华
    2021-02-01 07:12

    Not a perfect answer, but if you're using MVC4 they've built this in as a new feature. When running a Debug configuration, it outputs individual files with comments and such but when you switch to Release, it will automatically bundle, minify, and change in page references to the minified files. You can setup separate bundles for, say, jquery and your own js. This works with CSS and JS files.

    http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification

    If MVC4 doesn't work for you, you can also find packages on Nuget that can help such as this:

    https://www.nuget.org/packages?q=minify

提交回复
热议问题