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

css-purifier

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-purifier

Vite plugin for purification css files

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-70%
Maintainers
1
Weekly downloads
 
Created
Source

CSS Purifier

Vite Plugin for CSS Size Reduction

Installation

npm i css-purifier --save-dev

Usage

In your Vite configuration, import the plugin:

import { cssPurifier } from 'css-purifier';

Then invoke the plugin:

plugins: [
  cssPurifier(pureCssConfig),
]

Plugin Configuration

The plugin accepts a JavaScript object of the following format:

  • input - string. The name of the file you want to purify.
  • output - string. The name of the file that will be created from the input.
  • selectors - (string|RegExp)[]. Selectors that need to be retained from input to output. For example, ['.btn']. To indicate that a selector can be in any part of the selector, you can use this approach: selectors: ['.some-class', /popup/]. This will work on any classes that contain the word popup.
  • shouldPrintOutput - boolean. Whether to display the final content in debug mode.
  • shouldPrintSelectors - boolean. Whether to display selectors in debug mode.

Example

cssPurifier({
    input: 'node_modules/bootstrap/min-style.css',
    output: 'assets/styles/cleaned-bootstrap.css',
    selectors: [
        /popup/, '.heading',
    ],
    shouldPrintOutput: false,
    shouldPrintSelectors: true,
})

FAQs

Package last updated on 09 Dec 2023

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