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

style-data

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style-data

Get the content of style tags.

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
201K
increased by2.31%
Maintainers
1
Weekly downloads
 
Created
Source

style-data Build Status Coverage Status

NPM

Get the content of style tags.

Install

Install with npm

npm install --save style-data

Usage

var getStylesData = require('style-data');

getStylesData(html, options, function (err, results) {
    console.log(results.html);  // resulting html
    console.log(results.css);   // array of css rules
});

API

getStylesData(html, options, callback)

options.applyStyleTags

Type: Boolean
Default: true

Whether to inline styles in <style></style>.

options.removeStyleTags

Type: Boolean
Default: true

Whether to remove the original <style></style> tags after (possibly) inlining the css from them.

options.preserveMediaQueries

Type: Boolean
Default: false

Preserves all media queries (and contained styles) within <style></style> tags as a refinement when removeStyleTags is true. Other styles are removed.

cheerio options

Options to passed to cheerio.

Credit

The code for this module was originally taken from the Juice library.

License

MIT © Jonathan Kemp

Keywords

FAQs

Package last updated on 15 Mar 2016

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