fetch-css

4.1.2 • Public • Published

fetch-css

Extract CSS from websites and browser extensions

Usage

npm i fetch-css
import fetchCss from "fetch-css";

// retrieve CSS of a website
const [{css}] = await fetchCss([{url: "https://example.com"}]);

// extract CSS from a Chrome extension
const [{css}] = await fetchCss([{crx: "hlepfoohegkhhmjieoechaddaejaokhf"}]);

API

fetchCss(sources)

  • sources: Array Array of source objects
    • source: Object
      • url: string or Array An absolute URL pointing to either a website or directly to a CSS or JS file (to extract inlined CSS strings from)
      • fetchOpts: Object Options passed to fetch
      • crx: string A Chrome extension id
      • contentScriptsOnly: boolean Whether to pull only content scripts from a extension. Default: false
      • strict: boolean Whether to throw an error if fetch fails. Default: false

Returns a Promise that resolves to a sources array with additional css properties present on each source.

Related

  • remap-css - Remap CSS rules based on declaration value

© silverwind, distributed under BSD licence

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
4.1.245latest

Version History

VersionDownloads (Last 7 Days)Published
4.1.245
4.1.10
4.1.00
4.0.130
4.0.120
4.0.110
4.0.100
4.0.90
4.0.80
4.0.70
4.0.60
4.0.50
4.0.40
4.0.30
4.0.20
4.0.10
4.0.00
3.1.120
3.1.110
3.1.100
3.1.90
3.1.80
3.1.70
3.1.60
3.1.50
3.1.40
3.1.30
3.1.20
3.1.10
3.1.00
3.0.30
3.0.20
3.0.10
3.0.00
2.0.20
2.0.10
2.0.00
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i fetch-css

Weekly Downloads

45

Version

4.1.2

License

BSD-2-Clause

Unpacked Size

17 kB

Total Files

5

Last publish

Collaborators

  • silverwind