Socket
Socket
Sign inDemoInstall

postcss-design-system

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-design-system

PostCSS plugin for generating CSS variables from a JSON file


Version published
Maintainers
1
Created
Source

PostCSS Design System Build Status

PostCSS plugin for generating CSS custom properties (variables) from a JSON theme file. The theme config can come from any CSS-in-JS library's <ThemeProvider>, just like styled-system's one for example. It can also work with Compositor Lab.

Examples

An example JSON theme file:

{
  "breakpoints": [30, 48, 74],
  "colors": {
    "white": "#FFFFFF",
    "black": "#000000"
  },
  "fonts": ["-apple-system, sans-serif"],
  "fontSizes": [14, 16, 18],
  "radii": [3, 6, 12],
  "space": [15, 20, 40]
}

CSS variables get injected into :root selector:

:root {
  --breakpoint0: 30em;
  --breakpoint1: 48em;
  --breakpoint2: 74em;
  --color-white: #ffffff;
  --color-black: #000000;
  --fontFamily0: -apple-system, sans-serif;
  --fontSize0: 14px;
  --fontSize1: 16px;
  --fontSize2: 18px;
  --borderRadius0: 3px;
  --borderRadius1: 6px;
  --borderRadius2: 12px;
  --space0: 15px;
  --space1: 20px;
  --space2: 40px;
}

Usage

postcss([
  require('postcss-design-system')({
    inputFile: './theme.json',
  }),
]);

See PostCSS docs for examples for your environment.

Keywords

FAQs

Package last updated on 20 Jul 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc