nbergseng / connect-jsx

middleware to convert react jsx files to javascript on the fly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

connect-jsx

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));

About

middleware to convert react jsx files to javascript on the fly

License:MIT License


Languages

Language:JavaScript 100.0%