This site extension minifies html, css, js and images.
On startup of the webapp, the default directory (D:\home\site\wwwroot\) is scanned for .js, .html, .css,.jpeg,.png and .gif files. The files are then compressed and replaced. If a file is changed during runtime, they will be reprocessed immediately.
This project was greatly inspired by the existing site extension Azure Image Optimizer by Sayed-Ibrahim-Hashimi and Mads Kristensen and is based on the following libaries:
Zeta Producer Html Compressor, version 1.0.2
A .NET port of Google’s HtmlCompressor library to minify HTML source code.
Efficient stylesheet minification in C#
The method takes a string of CSS and returns a minified version of it. The method have been modified for demo purposes, so you might want to optimize the code yourself.
JSMin.Net, version 1.1.3
JSMin.NET is a .NET port of the Douglas Crockford's JSMin.
The image minifier is based on a couple of tools that Mads Kristensen picked:
- gifsicle.exe to minify gifs
- jpegtran.exe to minify jpgs
- zopflipng.exe to minify pngs
Currently the images are lossy compressed to get the best results. A configuration flag will follow.
Install this extension in the kudu site: https://.scm.azurewebsites.net/SiteExtensions/#gallery (replace with the name of your site!) Search for AzureExtension.FullMinifier Install it Then open the site https://.scm.azurewebsites.net/SiteExtensions/AzureExtension.FullMinifier
The following can be configured:
Default: D:\home\site\wwwroot
Overwrite them in the app setting of the website.
Default: .css;.html;.js Overwrite them in the app setting of the website.