Skip to content
/ cave Public

Remove critical CSS from your stylesheet after inlining it in your pages

License

Notifications You must be signed in to change notification settings

bevacqua/cave

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cave

Remove critical CSS from your stylesheet after inlining it in your pages

If you don't understand the purpose of this module, refer to penthouse which extracts critical CSS from a file, but doesn't remove it. Using this tool you can take the styles produced by an extraction tool like penthouse and actually remove them from your stylesheet.

Install

npm install cave --save

API

The cave exposes a single function that takes the file path to a stylesheet and a string containing valid CSS you want to remove from the provided stylesheet.

cave(stylesheet, options)

The options object contains the following properties.

Property Description
css The CSS rules to remove from the stylesheet. e.g: a { color: #f00; }

Cave will produce an AST and remove any matching rules, then the resulting CSS diff will be returned.

CLI

Cave works well with standard input.

cat path/to/file | cave <stylesheet> > slim.css

You can also pass in the critical CSS file as an option.

cave --css path/to/file <stylesheet> > slim.css

Tests

Run tests using npm.

npm test

License

MIT

About

Remove critical CSS from your stylesheet after inlining it in your pages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published