Socket
Socket
Sign inDemoInstall

@fullhuman/postcss-purgecss

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fullhuman/postcss-purgecss

PostCSS plugin for PurgeCSS


Version published
Weekly downloads
239K
decreased by-16.42%
Maintainers
2
Weekly downloads
 
Created

What is @fullhuman/postcss-purgecss?

@fullhuman/postcss-purgecss is a PostCSS plugin that removes unused CSS. It helps to reduce the size of your CSS files by only including the styles that are actually used in your HTML files.

What are @fullhuman/postcss-purgecss's main functionalities?

Basic Usage

This code demonstrates the basic usage of @fullhuman/postcss-purgecss. It configures the plugin to scan HTML files in the './src' directory and remove any unused CSS from the CSS files in the same directory.

const purgecss = require('@fullhuman/postcss-purgecss')({
  content: ['./src/**/*.html'],
  css: ['./src/**/*.css']
});

module.exports = {
  plugins: [
    purgecss
  ]
};

Whitelist Specific Classes

This code demonstrates how to whitelist specific CSS classes that should not be removed, even if they are not found in the HTML files. The 'safelist' option is used to specify these classes.

const purgecss = require('@fullhuman/postcss-purgecss')({
  content: ['./src/**/*.html'],
  css: ['./src/**/*.css'],
  safelist: ['whitelisted-class']
});

module.exports = {
  plugins: [
    purgecss
  ]
};

Extracting Dynamic Classes

const purgecss = require('@fullhuman/postcss-purgecss')({
  content: ['./src/**/*.html'],
  css: ['./src/**/*.css'],
  defaultExtractor: content => content.match(/[\

Other packages similar to @fullhuman/postcss-purgecss

FAQs

Package last updated on 13 Jun 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

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