Skip to content

voorjaar/css-chosen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

css-chosen

Dead simple CSS purge tool.

Installation

npm install css-chosen --save-dev

How

The project was inspired by uncss, we both tend to use dom's querySelector method. But we use css-select to select css rules, which allows us to remove the dependency of jsdom, so it will be smaller and faster.

The process by which css-chosen removes the unused rules is as follows:

  1. The HTML files are loaded by htmlparser2 to get doms.
  2. All the stylesheets are parsed by a simple build-in css parser.
  3. CSSselect.selectOne filters out selectors that are not found in the HTML files.
  4. The remaining rules are converted back to CSS.

Usage

windicss uses css-chosen to purge base styles added by third-party plugins.

Releases

No releases published

Packages

No packages published