How do I concatenate and minify files using webpack

Merge multiple CSS into single file can done using extract-text-webpack-plugin or webpack-merge-and-include-globally. https://code.luasoftware.com/tutorials/webpack/merge-multiple-css-into-single-file/ To merge multiple JavaScripts into single file without AMD or CommonJS wrapper can be done using webpack-merge-and-include-globally. Alternatively, you can expose those wrapped modules as global scope using expose-loader. https://code.luasoftware.com/tutorials/webpack/merge-multiple-javascript-into-single-file-for-global-scope/ Example using webpack-merge-and-include-globally. const path = require(‘path’); const MergeIntoSingleFilePlugin = require(‘webpack-merge-and-include-globally’); module.exports … Read more

Why does JS minification convert 1000 to 1E3?

The whole point of minification is to be able to pass less data over the network but retain the same functionality. Taken from wikipedia: Minification (also minimisation or minimization), in computer programming languages and especially JavaScript, is the process of removing all unnecessary characters from source code without changing its functionality. These unnecessary characters usually … Read more

jQuery compiled with Google Closure Compiler

John Resig reported a bug on recursive functions when he attempted to compile a nightly of jQuery 1.4, so there are a few kinks to be worked out. I wouldn’t use a jQuery compiled with Closure Compiler without making sure it passes the jQuery testbed. http://code.google.com/p/closure-compiler/issues/detail?id=1&can=1#c2

Minify HTML output from an ASP.Net MVC Application

Enabling GZIP will have much more effect than minifying your HTML, anyway. Doing minification at runtime could hurt your servers (assuming you don’t use caching). It may be a good idea to minfiy your Asp.Net markup during deployment. This way, you still have a non-minified version of code in your code repository, and a minified … Read more

Minify indented JSON string in .NET

Regex.Replace(myJSON, “(\”(?:[^\”\\\\]|\\\\.)*\”)|\\s+”, “$1″) should do it. It makes sure that strings that contain space characters are preserved, and all other space characters are discarded. All JSON keywords (false, true, null) have to be separated by commas or other punctuation so only white-space inside strings needs to be preserved. The first option (\”(?:[^\”\\\\]|\\\\.)*\”) matches a double … Read more

tech