JSPM

simplestyle-js-plugin-postcss

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q30830F
  • License MIT

PostCSS integration with simplestyle-js to provide helpful utility and additional features to the zero-dependency simplestyle base

Package Exports

  • simplestyle-js-plugin-postcss

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 (simplestyle-js-plugin-postcss) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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