Extract CSS from websites and browser extensions
npm i fetch-css
const fetchCss = require("fetch-css");
// retrieve CSS of a website
const [{css}] = await fetchCss([{url: "https://google.com"}]);
// extract CSS from a Chrome extension
const [{css}] = await fetchCss([{crx: "hlepfoohegkhhmjieoechaddaejaokhf"}]);
sources
: Array Array of source objectssource
: Objecturl
: string An absolute URL pointing to either a website or directly to a CSS filefetchOpts
: Object Options passed to fetchcrx
: string A Chrome extension idcontentScriptsOnly
: boolean Whether to pull only content scripts from a extension. Default:false
Returns a promise that resolves to a sources
object with additional css
properties present.
- remap-css - Remap CSS rules based on declaration value
© silverwind, distributed under BSD licence