fetch-css
v5.0.2
Published
Extract CSS from websites and browser extensions
Maintainers
Readme
fetch-css
Extract CSS from websites and browser extensions
Usage
pnpm add fetch-cssimport fetchCss from "fetch-css";
const [website, extension] = await fetchCss([
{url: "https://example.com"},
{crx: "hlepfoohegkhhmjieoechaddaejaokhf"}, // a Chrome extension
]);
console.log(website.css, extension.css);API
fetchCss(sources)
sources: Array Array of source objectssource: Objecturl: 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 fetchcrx: string A Chrome extension idcontentScriptsOnly: boolean Whether to pull only content scripts from an extension. Default:falsestrict: boolean Whether to throw an error if fetch fails. Default:false
Returns a Promise that resolves to a copy of the sources array with additional css properties present on each source. Sources with an array url are expanded into one source per URL.
Related
- remap-css - Remap CSS rules based on declaration value
© silverwind, distributed under BSD licence
