Package Exports
- postcss-modules-sync
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-modules-sync) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
postcss-modules-sync
A PostCSS plugin to use CSS Modules synchronously in js.
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)