简体   繁体   中英

minification Of JS And CSS In Asp.Net MVC

I'm working with Asp.Net MVC And i Use Jquery and Requir JS To Load JavaScript Files Like This:

   require(['backboneModal', 'ModalDialog', 'Java Script File Name'], function (backboneModal, ModalDialog, OpenSavedFilterModal) {

        OpenSavedFilterModal.getModal(portFolioNameSpace); 
    });

now i want to minification Java Script Files: i use Squishit For Java Script Files Which load in Views like this:

   @Html.Raw(SquishIt.Framework.Bundle.JavaScript()
            .Add("~/Scripts/example.js")
            .ForceRelease()
    .Render("~/scripts/combined_#.js")

) and it works .but files which loaded with Required don't change

I would personally use bundles that come with the nuget package Microsoft Web Optimization. https://www.nuget.org/packages/Microsoft.AspNet.Web.Optimization/

This way you can still reference the files from js.

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

Haven't used squish it or requir though so I might be wrong

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM