/postcss-remove-root

A PostCSS plugin to remove all instances of “:root” from a stylesheet.

Primary LanguageJavaScriptMIT LicenseMIT

postcss-remove-root

npm version Build Status Dependency Status

A PostCSS plugin to remove all instances of “:root” from a stylesheet.

This plugin is very basic. It removes all instances of :root from a processed stylesheet (if present). It comes in handy if you are using postcss-custom-properties to process CSS variables. The included test assumes this scenario.

Otherwise, you probably have no use for this plugin. You should run this plugin after running postcss-custom-properties.

Installation

npm install --save postcss-remove-root

Example

Input

:root {
  --color-blue: blue;
}

.color-blue {
  color: var(--color-blue);
}

Output

.color-blue {
  color: blue;
}

Usage

See the PostCSS documentation for examples on how to use this plugin in different environments.

Contributing

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests ($ npm test).

Credits

postcss-remove-root is a project by @cbracco and its contributors. It is based on code originally found in Basscss, a project by jxnblk. This README is based on the one found in postcss-import.

Thank you for your hard work!