This package has been deprecated

Author message:

Please use jsx-transform instead.

virtual-dom-jsx

0.3.0 • Public • Published

virtual-dom-jsx

Build Status NPM version Dependency Status

JSX transpiler for vtrees. Desugar JSX into virtual-dom nodes.

Installation

npm install virtual-dom-jsx

Example

This JSX:

/** @jsx h */
 
var h = require('virtual-hyperscript');
 
var profile = <div>
  <img src="avatar.png" class="profile" />
  <h3>{[user.firstName, user.lastName].join(' ')}</h3>
</div>;

is transformed into this JavaScript:

var h = require('virtual-hyperscript');
 
var profile = h('div', null, [
  h('img', { src: "avatar.png", class: "profile" }),
  h('h3', null, [[user.firstName, user.lastName].join(' ')])
]);

Usage

docblock

Only files with the /** @jsx DOM */ docblock will be parsed unless options.ignoreDocblock is set. The constructor name for the virtual DOM node is taken from the @jsx definition.

jsx.parse(str, options)

Desugar JSX into virtual dom nodes and return transformed string.

jsx.parseFile(path, options)

Desugar JSX in file into virtual dom nodes and return transformed string.

Options

  • ignoreDocblock Parse files without docblock. If true, options.jsx must also be set (default: false).
  • tagMethods Use tag as method instead of argument (default: false). If true, DOM.h1() instead of DOM('h1').
  • jsx name of virtual DOM node constructor (default: false).

BSD Licensed

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i virtual-dom-jsx

Weekly Downloads

1

Version

0.3.0

License

BSD

Last publish

Collaborators

  • amingoia