postcss-modules-sync

A PostCSS plugin to use CSS Modules synchronously in js

MIT 2 个版本
安装
npm install postcss-modules-sync
yarn add postcss-modules-sync
pnpm add postcss-modules-sync
bun add postcss-modules-sync
README

postcss-modules-sync

A PostCSS plugin to use CSS Modules synchronously in js.

version MIT License

Install

npm install postcss-modules-sync

Example

import CSSModulesSync from 'postcss-modules-sync'
import postcss from 'postcss'

const css = `
  :global .text {
    color: white;
    background-color: gray;
  }

  .green {
    background-color: green;
  }

  .blue {
    background-color: blue;
  }

  .default {
    composes: green;
    display: flex;
  }
`

let exportedTokens = {}
const styles = postcss([
  CSSModulesSync({
    generateScopedName: '[path][local]-[hash:base64:10]',
    getJSON: tokens => exportedTokens = tokens
  })
]).process(css).css

console.log('styles', styles)
console.log('tokens', exportedTokens)
版本列表
1.0.0 2017-01-24
0.1.0 2016-10-25