![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
custom-property-extract
Advanced tools
Extract CSS custom properties (a.k.a CSS variables) and their values from stylesheets.
Extract CSS custom properties (a.k.a CSS variables) and their values from SCSS
, SASS
and CSS
stylesheets.
Since they can be overwritten in selectors, every custom property returns an array of all possible values directly extracted from the provided stylesheet. See Example to get a quick overview on how things work.
Install custom-property-extract by running the following command:
npm install custom-property-extract
const path = require('path');
const { extract } = require('custom-property-extract');
const customProperties = extract(path.resolve('./path/to/stylesheet.scss'), { syntax: 'scss' });
Alternatively, you can directly pass the content of the stylesheet in the sourceStyle
argument by
setting the source
option to "content"
:
const path = require('path');
const { extract } = require('custom-property-extract');
const style = `
:root {
--my-variable: blue;
}
`;
const customProperties = extract(style, {
syntax: 'scss',
source: 'content',
});
Name | Type | Required | Default | Description |
---|---|---|---|---|
syntax | {String} | false | "css" | Syntax of the source stylesheet ("css" , "scss" , "sass" ) |
source | {String} | false | "file" | Type of the source ("file" , "content" ) |
prefix | {Boolean} | false | true | Determines whether to prefix custom properties with -- . |
Consider the following CSS stylesheet:
@charset "UTF-8";
:root {
--color-primary: #ff017d;
--color-secondary: #000;
--color-background: white;
--color-foreground: var(--color-secondary);
--radius-round: 50% 50%;
--spacing-s: 5rem;
--shadow-xs: 1px 2px 3px 4px rgba(0,0,0,0.25), inset 4px 3px 2px 1px #fff;
--border-light: 1px solid rgba(0,0,0,0.15);
--amount-suffix-content: '€';
--margin-default: 0.5rem !important;
}
[data-theme="dark"] {
--color-primary: #cf689a;
--color-secondary: blue;
--color-background: var(--color-background);
}
[data-theme="dark"].nested {
--color-primary: blue;
--width-header: calc(100vh - (3rem / 2));
}
[data-lang="us"] {
--amount-suffix-content: '$';
}
@media screen and (min-width: 960px) {
:root {
--color-primary: blue;
}
}
Using custom-property-extract's extract function will output the following object:
{
'--color-primary': [ '#ff017d', '#cf689a', 'blue', 'blue' ],
'--color-secondary': [ '#000', 'blue' ],
'--color-background': [ 'white', 'var(--color-background)' ],
'--color-foreground': [ 'var(--color-secondary)' ],
'--radius-round': [ '50% 50%' ],
'--spacing-s': [ '5rem' ],
'--shadow-xs': [ '1px 2px 3px 4px rgba(0,0,0,0.25), inset 4px 3px 2px 1px #fff' ],
'--border-light': [ '1px solid rgba(0,0,0,0.15)' ],
'--amount-suffix-content': [ "'€'", "'$'" ],
'--margin-default': [ '0.5rem !important' ],
'--width-header': [ 'calc(100vh - (3rem / 2))' ]
}
FAQs
Extract CSS custom properties (a.k.a CSS variables) and their values from stylesheets.
The npm package custom-property-extract receives a total of 19 weekly downloads. As such, custom-property-extract popularity was classified as not popular.
We found that custom-property-extract 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
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.