Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
postcss-only-one-root
Advanced tools
A PostCSS plugin to remove all instances of “:root” but one from a stylesheet.
This plugin is very basic. It removes all instances of :root
except for the first it encounters from a processed stylesheet (if present). I built this as I used automatical localised imports for my Webpack scss files, which occured in duplicate references to the :root selector variables.
Otherwise, you probably have no use for this plugin. You should run this plugin after running [postcss-custom-properties]
npm install --save postcss-only-one-root
:root {
--color-blue: blue;
}
@import "./variables";
.something-1 {
color: var(--color-blue);
}
@import "./variables";
.something-2 {
color: var(--color-blue);
}
:root {
color-blue: blue
}
.something-1 {
color: blue;
color: var(--color-blue);
}
.something-2 {
color:blue;
color: var(--color-blue);
}
See the PostCSS documentation for examples on how to use this plugin in different environments. This plugin takes no options.
FAQs
Removes all but one instance of :root
We found that postcss-only-one-root 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.