• Stars
    star
    293
  • Rank 141,748 (Top 3 %)
  • Language
    JavaScript
  • Created over 10 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

JSX transpiler. A standard and configurable implementation of JSX decoupled from React.

jsx-transform Build Status NPM version Dependency Status

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.

JSX is a JavaScript syntax for composing virtual DOM elements. See React's documentation for an explanation.

For linting files containing JSX see JSXHint.

Installation

npm install jsx-transform

API

jsx-transform

This module aims to be a standard and configurable implementation of JSX decoupled from React for use with Mercury or other modules.

JSX is a JavaScript syntax for composing virtual DOM elements. See React's documentation for an explanation.

For linting files containing JSX see JSXHint.

jsx-transform~fromString(str, [options]) β‡’ String

Desugar JSX and return transformed string.

Kind: inner method of jsx-transform

Param Type Description
str String
[options] Object
options.factory String Factory function name for element creation.
[options.spreadFn] String Name of function for use with spread attributes (default: Object.assign).
[options.unknownTagPattern] String uses given pattern for unknown tags where {tag} is replaced by the tag name. Useful for rending mercury components as Component.render() instead of Component().
[options.passUnknownTagsToFactory] Boolean Handle unknown tags like known tags, and pass them as an object to options.factory. If true, createElement(Component) instead of Component() (default: false).
[options.unknownTagsAsString] Boolean Pass unknown tags as string to options.factory (default: false).
[options.arrayChildren] Boolean Pass children as array instead of arguments (default: true).

Example

var jsx = require('jsx-transform');

jsx.fromString('<h1>Hello World</h1>', {
  factory: 'mercury.h'
});
// => 'mercury.h("h1", null, ["Hello World"])'

jsx-transform~fromFile(path, [options]) β‡’ String

Kind: inner method of jsx-transform

Param Type
path String
[options] Object

jsx-transform~browserifyTransform([filename], [options]) β‡’ function

Make a browserify transform.

Kind: inner method of jsx-transform
Returns: function - browserify transform

Param Type Description
[filename] String
[options] Object
[options.extensions] String Array of file extensions to run browserify transform on (default: ['.js', '.jsx', '.es', '.es6']).

Example

var browserify = require('browserify');
var jsxify = require('jsx-transform').browserifyTransform;

browserify()
  .transform(jsxify, options)
  .bundle()

Use .configure(options) to return a configured transform:

var browserify = require('browserify');
var jsxify = require('jsx-transform').browserifyTransform;

browserify({
  transforms: [jsxify.configure(options)]
}).bundle()

Use in package.json:

"browserify": {
  "transform": [
    ["jsx-transform/browserify", { "factory": "h" }]
  ]
}

BSD Licensed

More Repositories

1

purescript-pux

Build type-safe web apps with PureScript.
PureScript
566
star
2

sticky

Simple, key/value pair browser-storage cache leveraging the latest HTML5 storage APIs.
JavaScript
324
star
3

koa-resource-router

RESTful rails-style resource routing for koa
JavaScript
147
star
4

pux-starter-app

Starter Pux app w/ hot-reloading and isomorphic routing and rendering
PureScript
102
star
5

twain

Tiny web application framework for WAI.
Haskell
66
star
6

pux-devtool

Pux time-travelling devtool.
JavaScript
43
star
7

gulp-file

Create vinyl files from a string or buffer and insert into the Gulp pipeline.
JavaScript
42
star
8

mongoose-populate-virtuals

Extend Mongoose 4+ population with virtual attributes that can be populated in either direction.
JavaScript
33
star
9

virtual-dom-component

A virtual component (view). Virtual components expose events, state lens, and a render function.
JavaScript
30
star
10

virtual-dom-stringify

Deprecated. Use https://github.com/nthtran/vdom-to-html/.
JavaScript
25
star
11

html-virtualize

Parse HTML into virtual-dom tree.
JavaScript
20
star
12

gulp-jsx

virtual-dom-jsx for gulp
JavaScript
14
star
13

pux-todomvc

Pux TodoMVC
PureScript
13
star
14

express-elasticsearch-logger

Log requests to ElasticSearch.
JavaScript
12
star
15

modella-resource

Expose Modella models via RESTful resource middleware.
JavaScript
10
star
16

watch

Watch files and folders for changes, and run commands when they change. Linux, OS X, and Windows are supported.
Go
8
star
17

hyperobject

A simple object model for working with Linked Data.
JavaScript
7
star
18

dotfiles

My OS X setup using Nu shell and Helix editor.
Nushell
7
star
19

pux-css

Render purescript-css to a Pux attribute.
PureScript
5
star
20

modella-mysql

MySQL plugin for Modella.
JavaScript
4
star
21

mongoose-express-router

Create Express 4 router and middleware from Mongoose 4 model.
JavaScript
4
star
22

charisi

A rich text editor for the web, built for speed and stability
JavaScript
3
star
23

purescript-markdown-smolder

Render purescript-markdown to purescript-smolder.
PureScript
3
star
24

webmention

Types and functions for working with webmentions.
Haskell
3
star
25

pux-websockets

PureScript
3
star
26

wai-responder

A tiny web application framework for WAI.
Haskell
2
star
27

modella-memory

Memory persistence layer for Modella. Useful for development or as a reference implementation for Modella storage plugins.
JavaScript
2
star
28

express-snapshot

Generate static HTML from Express. Express app in, static .html out.
JavaScript
2
star
29

zero.css

Classy style without classes
CSS
1
star
30

daily-standup

Command-line tool for posting what you did today and the GitHub commits from yesterday to HipChat.
JavaScript
1
star