Extract all CSS from a given url, both server side and client side rendered.
Problem, solution and shortcomings
Existing packages like
look at a server-generated piece of HTML and get all the
tags from it. This works fine for 100% server rendered pages, but apps that
Currently, there is no solution to get the CSS from modules that use Styled Components or something similar. Any help resolving this issue will be very much appreciated. Please contribute to the relevant GitHub issue.
npm install extract-css-core # Or with Yarn yarn add extract-css-core
const extractCss = require('extract-css-core') extractCss('http://www.projectwallace.com').then(css => console.log(css))
Extract CSS from a page. Returns a Promise that contains the CSS as a single String.
true if you want a Chromium window to open as it works to get all the
CSS from the page.
Can be any value as provided by the Puppeteer docs.
An object consisting of the following fields:
executablePath: the path to a Chromium binary
puppeteer: a Puppeteer instance
args: arguments to start Chromium with
test directory for implementation examples. This option exists
primarily for use with extract-css.now.sh