Socket
Socket
Sign inDemoInstall

cave

Package Overview
Dependencies
12
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cave

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


Version published
Maintainers
1
Install size
1.89 MB
Created

Readme

Source

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, done)

The options object contains the following properties.

PropertyDescription
cssThe CSS rules to remove from the stylesheet. e.g: a { color: #f00; }

Cave will produce an AST and remove any matching rules, then the done callback will be executed.

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

FAQs

Last updated on 19 Oct 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc