middleware to convert react jsx files to javascript on the fly
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE.md
README.md
connect-jsx.js
index.js
package.json

README.md

connect-jsx Build Status: Linux

Middleware to convert react jsx files to javascript on the fly.

Overview

In response to an HTTP GET for a file ending in .js, the module looks for a corresponding file with a .jsx extension, and if found, compiles it into the javascript equivalent.

This is useful with require.js or similar front-end javascript loaders as an alternative to having to do the jsx compilation in the browser.

Uses react-tools to do the actual transformation and send to do the heavy lifting of the actual static file serving.

Installation

npm install --save connect-jsx

Usage

Similar usage to connect.static:

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

var root = __dirname; // base directory with .jsx files
var app = connect();
app.use(jsx(root));