Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

Package Overview
Dependencies
Maintainers
3
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

  • 1.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
122
increased by106.78%
Maintainers
3
Weekly downloads
 
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 purifyCss 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'
    })
  ]
}

purifyCSS

PurifyCSS options

OptionDescriptiondefault
minifySet to true to minifyfalse
outputFilepath to write purified CSS to. Returns raw stringAlways false
infoLogs info on how much CSS was removedfalse
rejectedLogs the CSS rules that were removed if truefalse
whitelistArray of selectors to always leave in. Ex. ['button-active', 'modal'] this will leave any selector that includes modal in it and selectors that match button-active. (wrapping the string with *'s, leaves all selectors that include it)[]
module.export = {
  ...
  plugins: [
    new HtmlWebpackPurifyInternalCssPlugin({
      level: process.env.NODE_ENV === 'development'? 'none': 'auto',
      purifyCSS: {
        info: true,
        rejected: true,
        whitelist: [
          '.♥'
        ]
      }
    })
  ]
}

FAQs

Package last updated on 07 Jan 2019

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