postcss-modules-sync
A PostCSS plugin to use CSS Modules synchronously in js
Last updated 8 years ago by schiehll .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install postcss-modules-sync 
SYNC missed versions from official npm registry.

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)

Current Tags

  • 1.0.0                                ...           latest (8 years ago)

2 Versions

  • 1.0.0                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |