1.0.0 • Published 9 years ago

babel-plugin-transform-h-jsx v1.0.0

Weekly downloads
44
License
MIT
Repository
github
Last release
9 years ago

JSX to Virtual Hyperscript Babel Plugin

Turns JSX into virtual-hyperscript via Babel.

This repo is essentially transform-react-jsx except it passes children as an array instead of as additional arguments. You can read more about this problem if you like.

Installation

npm install --save-dev babel-plugin-transform-h-jsx

Usage

Add transform-h-jsx as a plugin in your babel config.

{
  "plugins": ["transform-h-jsx"]
}

Options

  • pragma (default: 'h')

Webpack example

In your webpack.config.js file:

module.exports = {
  output: {
    path: __dirname + "/dist/js",
    filename: "browser.js"
  },
  context: __dirname + "/src",
  entry: "./browser",
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        include: __dirname + '/src',
        loader: "babel-loader",
        query: {
          plugins: [
            ["transform-h-jsx"],
            ["syntax-jsx"]
          ]
        }
      }
    ]
  },
  resolve: {
    extensions: ['', '.js', '.jsx', '.json']
  }
};