JSPM

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

Babel plugin to convert css imports into jss objects

Package Exports

  • babel-plugin-transform-import-css

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

Readme

This is a simple babel plugin to inline css into js vis jss.

This plugin is very much experimental due to use of the Babel6 API - largely undocumented. Contributions are welcome.

Usage

The following command will convert everything in the src folder to lib using babel and our plugin.

babel src/ -d lib/ --presets stage-0,es2015,react --plugins import-css-to-jss

Every js file that has a statement such as:

import styles from './styles.css'

will be roughtly translated to:

var styles = {
    // the css file converted to JSS
}

Use Cases

The only use case of this plugin is to be able to bundle css styles with your js components. It is good for portability.