GithubHelp home page GithubHelp logo

munter / express-jsxtransform Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gustavnikolaj/express-jsxtransform

0.0 3.0 0.0 102 KB

Express middleware that transforms jsx on the way out.

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

express-jsxtransform's Introduction

express-jsxtransform

NPM version Build Status Dependency Status

Middleware that compiles jsx on-the-fly. Intended to be used in a development setting with the express.static middleware, but should work with any middleware further down the stack, even an http proxy.

The response will be rewritten under these circumstances:

  • If the response is a file with the .js extension and has the /** @jsx ... */ annotation on the first line.
  • If the response is a file with the .jsx extension. In this case the annotation is optional.

jsxtranform plays nice with conditional GET. If the original response has an ETag, jsxtransform will add to it so the ETag of the compiled response never clashes with the original ETag. That prevents the middleware issuing the original response from being confused into sending a false positive 304 Not Modified if jsxtransform is turned off or removed from the stack later.

Installation

Make sure you have node.js and npm installed, then run:

npm install express-jsxtransform

Example usage

var express = require('express'),
    jsxtransform = require('express-jsxtransform'),
    root = '/path/to/my/static/files';

express.createServer()
    .use(jsxtransform())
    .use(express.static(root))
    .listen(1337);

License

3-clause BSD license -- see the LICENSE file for details.

Credit

This module is heavily based on the work of Andreas Lind Petersen (@papandreou) in his module express-compiless.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.