Académique Documents
Professionnel Documents
Culture Documents
Applications with 1
Microsoft ASP.NET -
I376
Web Application
Programming II – I713
IT College, Andres Käver, 2016-2017, Spring semester
Web: http://enos.Itcollege.ee/~akaver/ASP.NETCore
Skype: akaver Email: akaver@itcollege.ee
Bundling and Minification
Bundling
Bundling is a feature that makes it easy to combine or bundle
multiple files into a single file.
Minification
Minification performs a variety of different code optimizations to
reduce the size of requested assets (such as CSS, images,
JavaScript files). Common results of minification include removing
unnecessary white space and comments, and shortening variable
names to one character.
Bundling and Minification
JS before minification
After minification
AddAltToImg=function(t,a){var r=$(t,a);r.attr("alt",r.attr("id").replace(/ID/,""))};
Bundling and Minification
Minification
Level 1 – removal of white space and comments
Level 2 – removal of extra semicolons and curly braces
Level 3 – local variable shortening
Level 4 – remove unreachable code
Level 5 – Global shortcuts and shortening of function names
Minification
Jquery
300kb -> 100kb
Jquery UI
430kb -> 220kb
AngularJS
500kb -> 100kb
!!!!! Higher level of minification???
Bundling and Minification
https://marketplace.visualstudio.com/items?
itemName=MadsKristensen.BundlerMinifier
BuildBundlerMinifier
Bundling and Minification
[
{
"outputFileName": "wwwroot/css/site.min.css",
Configuration is in "inputFiles": [
"wwwroot/css/site.css"
bundleconfig.json ]
},
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"wwwroot/js/site.js"
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
}
]
Bundling and Minification
"inputFiles": ["wwwroot/**/*(*.css|!(*.min.css)"]
gets all css files and excludes the minified file pattern
Bundling and Minification