Skip to content

Latest commit

 

History

History
45 lines (36 loc) · 1.15 KB

README.md

File metadata and controls

45 lines (36 loc) · 1.15 KB

PostCSS Shared Options

Build Status npm version

PostCSS plugin share variables between different css files with scope. This implementation may replace values variables in css-modules and allow using native css variables syntax.

Before

/* vars.css */
:root {
  --root-width: 25px;
}
@shared --root-width from "./vars.css";
.foo {
    width: var(--root-width);
    height: calc(var(--root-width) * 2);
}

After

:root {
  --root-width-<md5_hash>: 25px;
}
.foo {
  width: var(--root-width-<md5_hash>);
  height: calc(var(--root-width-<md5_hash>) * 2);
}

Usage

postcss([ require('postcss-shared-options') ])

See PostCSS docs for examples for your environment.