
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
extract-css-core
Advanced tools
Extract all CSS from a given url, both server side and client side rendered.
Extract all CSS from a given url, both server side and client side rendered.
Existing packages like
get-css
look at a server-generated piece of HTML and get all the <link>
and <style>
tags from it. This works fine for 100% server rendered pages, but apps that
employ style injection with JavaScript will not be covered.
This module uses an instance of Chromium to render a page. This has the benefit that most of the styles can be rendered, even when generated by JavaScript. The Puppeteer CSSCoverage API is the power behind finding most of the CSS.
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.
Type: Object
Default: null
Type: Boolean
Default: false
Set to true
if you want a Chromium window to open as it works to get all the
CSS from the page.
Type: String
Default: networkidle2
Can be any value as provided by the Puppeteer docs.
Type: Object
Default: null
An object consisting of the following fields:
executablePath
: the path to a Chromium binarypuppeteer
: a Puppeteer instanceargs
: arguments to start Chromium withSee the test
directory for implementation examples. This option exists
primarily for use with extract-css.now.sh
FAQs
Extract all CSS from a given url, both server side and client side rendered.
The npm package extract-css-core receives a total of 2,102 weekly downloads. As such, extract-css-core popularity was classified as popular.
We found that extract-css-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.