New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html-minify-loader

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-minify-loader

Loader for webpack that minifies HTML using (minimize)[https://github.com/Moveo/minimize]

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
697
decreased by-22.38%
Maintainers
1
Weekly downloads
 
Created
Source

html-minify-loader

Loader for webpack that minifies HTML using minimize

To install

npm install html-minify-loader --save-dev

Use Case

Use it when you need to reduce the file size of your webpack template modules by removing comments and extra spaces from your templates

Example

webpack 1

module: {
    loaders: [
        {
                test: /\.html$/,
                name: "mandrillTemplates",
                loader: 'raw!html-minify'
        }
    ]
}

You can pass minimize parameters via 'html-minify-loader' property of webpack config.

module: {
    loaders: [
        {
                test: /\.html$/,
                name: "mandrillTemplates",
                loader: 'raw!html-minify'
        }
    ]
},
'html-minify-loader': {
     empty: true,        // KEEP empty attributes
     cdata: true,        // KEEP CDATA from scripts
     comments: true,     // KEEP comments
     dom: {                            // options of !(htmlparser2)[https://github.com/fb55/htmlparser2]
            lowerCaseAttributeNames: false,      // do not call .toLowerCase for each attribute name (Angular2 use camelCase attributes)
     }
}

webpack 2

You can pass minimize parameters via options property of loader. Example with multiple loaders.

module: {                                                           
   rules: [                                                        
	  {
		 test: /\.html$/, include: [applicationSource],
		 loaders: [
			'file-loader?publicPath=/,name=[path][name].min.[ext]',
			{
			   loader: 'html-minify-loader',
			   options: {
				  quotes: true,
				  dom: { lowerCaseTags: false }
			   }
			}
		 ]
	  }
   ]
}

FAQs

Package last updated on 13 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc