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

JSX transpiler. Desugar JSX into JavaScript.
This module aims to be a standard and configurable implementation of JSX decoupled from React for use with Mercury or other modules.
For linting files containing JSX see JSXHint.
Installation
npm install jsx-transformExample
var jsx = require('jsx-transform');
jsx.fromString('<h1>Hello World</h1>', {
factory: 'mercury.h'
});
// => 'mercury.h("h1", null, ["Hello World"])'JSX
JSX is a JavaScript syntax for composing virtual DOM elements. See React's documentation for an explanation.
API
Members
##jsx-transform~fromString(str, [options]) Desugar JSX and return transformed string.
Params
- str
String - [options]
Object- factory
String- Factory function name for element creation. - [passUnknownTagsToFactory]
Boolean- Handle unknown tags like known tags, and pass them as an object tooptions.factory. If true,createElement(Component)instead ofComponent()(default: false). - [unknownTagsAsString]
Boolean- Pass unknown tags as string tooptions.factory(default: false). - [arrayChildren]
Boolean- Pass children as array instead of arguments (default: true).
- factory
Scope: inner function of jsx-transform
Returns: String
##jsx-transform~fromFile(path, [options])
See module:jsx-transform.fromString for usage.
Params
- path
String - [options]
Object
Scope: inner function of jsx-transform
Returns: String
##jsx-transform~browserifyTransform([options])
Return a browserify transform.
See module:jsx-transform.fromString for options.
Params
- [options]
Object
Scope: inner function of jsx-transform
Returns: function - browserify transform
Example
var browserify = require('browserify');
var jsxify = require('jsx-transform').browserify;
browserify()
.transform(jsxify(options))
.bundle()