javascript - how will asp.net mvc-5 bunble behave if i am referecing .min and the full scripts -


i working on asp.net mvc-5 web application . , inside bundle define following (where referencing .js , min.js files):-

 bundles.add(new scriptbundle("~/bundles/jstemplate").include( "~/bower_components/moment/min/moment.min.js", "~/bower_components/fullcalendar/dist/fullcalendar.min.js", "~/js/jquery.datatables.min.js",  "~/bower_components/responsive-tables/responsive-tables.js",  "~/bower_components/bootstrap-tour/build/js/bootstrap-tour.min.js",  "~/js/jquery.raty.min.js",               )); 

where referencing .js & min.js files, how bundle work in case on production server ?. know bundle (when debug=false) these 2 main tasks:- 1. combine scripts inside bundle single file 2. minify combined file.

now in case bundle contain minify , non-minify files, mean minify files additional minification ? or minified files can not minified , bundle deliver .min.js client ?

the bundle minify files first(if not minified already) , join them in single file served browser, instead of several independent files.

if minified files have variables can further minified, so, removing additional spaces , line breaks.

on side note, debug=false not variable can play test this. can use enableoptimizations inside bundleconfig class, , code below can test in local environment if have connectionstring can refer to, or modify needs.

        using (dbcontext db = new dbcontext())         {             if (db.database.connection.connectionstring.tolower().contains("localdb"))                 bundletable.enableoptimizations = false;             else                 bundletable.enableoptimizations = true;         } 

if enableoptimizations false, server send original files individually browser (exactly way have them, minified or not, independent).

edit: tested bit more make sure, , yes bundle not care if have .min. in filename, still try minify file anyway, , additionally found feature did not know possible, changed testing code this:

var foo = function(){     var x = "hello";     console.log(x); } 

to this:

var foo;foo=function(){console.log("hello")} 

did not modify foo because in global namespace? more surprisingly, go rid of x variable.

weird!?


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -