![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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.
const extractCss = require('extract-css-core')
const css = await extractCss('https://www.projectwallace.com')
//=> html{font-size:100%} etc.
Or, if you want more details:
const entries = await extractCss('https://www.projectwallace.com', {
origins: 'include'
})
// entries will look something like this
[
{
href: 'https://www.projectwallace.com',
type: 'link',
css: '@font-face{font-display:swap;font-family:Teko;...'
},
{
href: 'https://www.projectwallace.com/client/Seo.0f4fe72f.css',
type: 'style',
css: '.hero__text.svelte-qhblau a{color:var(--teal-400)}...'
},
{
href: 'https://www.projectwallace.com/client/some-css-file.css',
type: 'import',
css: '.some-css {}'
},
{
href: 'https://www.projectwallace.com',
type: 'inline',
css: '[x-extract-css-inline-style] { position: absolute; }'
}
]
npm install extract-css-core
# or
yarn add extract-css-core
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 not for pages with
CSS-in-JS styling and inline styles 👎.
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
document.styleSheets
API is used to get all styles, including CSS-in-JS. Lastly, a plain old document.querySelectorAll('[style]')
finds all inline styling.
Extract CSS from a page. Returns a Promise that contains the CSS as a single
String, or an Array of all entries found when the option origins: 'include'
is passed.
Type: Object
Default: {}
Type: String
Default: exclude
Possible values: exclude
, include
Type: String
Default: include
Possible values: exclude
, include
Type: String
Default: networkidle0
Can be any value as provided by the Puppeteer docs.
FAQs
Extract all CSS from a given url, both server side and client side rendered.
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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.