Popular blog tags

Minifying Inline Css, Js and Html using BundlerMinifier in ASP.NET Core



how to use:

https://github.com/madskristensen/BundlerMinifier/wiki   https://www.hanselman.com/blog/OptionsForCSSAndJSBundlingAndMinificationWithASPNETCore.aspx

Options for CSS and JS Bundling and Minification with ASP.NET Core in vs2017 Features Bundles CSS, JavaScript or HTML files into a single output file Saving a source file triggers re-bundling automatically Support for globbing patterns MSBuild support for CI scenarios supported Minify individual or bundled CSS, JavaScript and HTML files Minification options for each language is customizable Shows a watermark when opening a generated file Task Runner Explorer integration Command line support Shortcut to update all bundles in solution Suppress output file generation Convert to Gulp bundleconfig.json The extension adds a bundleconfig.json file at the root of the project which is used to configure all bundling.

Here's an example of what that file looks like:

// Configure bundling and minification for the project.
// More info at https://go.microsoft.com/fwlink/?LinkId=808241
    "outputFileName": "wwwroot/css/site.min.css",
    // An array of relative input file paths. Globbing patterns supported
    "inputFiles": [
    "outputFileName": "wwwroot/js/site.min.js",
    "inputFiles": [
    // Optionally specify minification options
    "minify": {
      "enabled": true,
      "renameLocals": true
    // Optionally generate .map file
    "sourceMap": false