1.0.0 • Published 6 years ago

babel-plugin-stylis v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

babel-plugin-stylis

babel-plugin-stylis is a babel plugin to precompile a style string into a minified and optimized version. For so it uses the stylis package.

Install

$ npm i babel-plugin-stylis # or yarn add babel-plugin-stylis

Usage:

Add the plugin to your .babelrc:

{
  "plugins": [
    [
      "babel-plugin-stylis",
      {
        /* options */
      }
    ]
  ]
}

From now on the css tagged template expression will be available in your code:

var s = css`
  .some-class {
    display: flex;
  }
`;

transforming your css to a minified and optimized version:

var s = ".some-class{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}";

License

MIT