Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@aofl/html-webpack-purify-internal-css-plugin

Package Overview
Dependencies
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aofl/html-webpack-purify-internal-css-plugin

This is a plugin for [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin). It uses [PurifyCSS](https://github.com/purifycss/purifycss) to remove all unused css rules from internal styles of the generated html.

latest
Source
npmnpm
Version
3.5.0
Version published
Maintainers
2
Created
Source

@aofl/html-webpack-purify-internal-css-plugin

This is a plugin for html-webpack-plugin. It uses PurifyCSS to remove all unused css rules from internal styles of the generated html.

Installation

npm i -D @aofl/html-webpack-purify-internal-css-plugin

Usage

const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPurifyInternalCssPlugin = require('@aofl/html-webpack-purify-internal-css-plugin');

module.export = {
  ...
  plugins: [
    new HtmlWebpackPlugin(),
    new HtmlWebpackPurifyInternalCssPlugin()
  ]
}

Options

level

Level specifies pruning strategy.

optionDescription
autoThis is the default behavior. It prunes unused css rules based on the generated html and the purgeCss options.
whitelistOnly keep whitelisted rules.
allPrune everything
nonePrune nothing. (Useful for development to be able to toggle classes in devtools)
module.export = {
  ...
  plugins: [
    new HtmlWebpackPurifyInternalCssPlugin({
      level: process.env.NODE_ENV === 'development'? 'none': 'auto'
    })
  ]
}

purgeCss

purgeCss options

module.export = {
  ...
  plugins: [
    new HtmlWebpackPurifyInternalCssPlugin({
      level: process.env.NODE_ENV === 'development'? 'none': 'auto',
      purgeCss: {
        whitelist?: Array<string>,
        whitelistPatterns?: Array<RegExp>,
        whitelistPatternsChildren?: Array<RegExp>,
        keyframes?: boolean,
        fontFace?: boolean,
        rejected?: boolean
      }
    })
  ]
}

FAQs

Package last updated on 03 Mar 2020

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