simplestyle-js-plugin-postcss
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

simplestyle-js-plugin-postcss Build Status

A simplestyle-js posthook plugin for transforming the CSS generated by simplestyle-js with PostCSS and PostCSS plugins

Installation

npm install simplestyle-js-plugin-postcss --save

Usage

import { createStyles, registerPostHook } from 'simplestyle-js';
import simplestylePostCSSPlugin from 'simplestyle-js-plugin-postcss';

registerPostHook(simplestylePostCSSPlugin(
  [ /* Array of PostCSS plugins, like autoprefixer, cssnano, etc */ ],
  { /* postcss process options (optional) */ },
);
const styles = createStyles({
  myButton: {
    '&:hover': {
      backgroundColor: 'red',
    },
    '&:active, &:focus': {
      borderColor: 'blue',
    },
    backgroundColor: 'black',
    border: '1px solid',
    boxSizing: 'border-box',
    color: 'white',
  },
});
const btn = document.createElement('button');
btn.classList.add(styles.myButton); // button will have styles that were transformed with PostCSS
document.body.appendChild(btn);

License

MIT

Package Sidebar

Install

npm i simplestyle-js-plugin-postcss

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

8.62 kB

Total Files

12

Last publish

Collaborators

  • stratodyne