Skip to content

Commit

Permalink
Merge pull request #39 from One-com/feature/jsxtransform
Browse files Browse the repository at this point in the history
add --jsxtransform switch
  • Loading branch information
papandreou committed May 20, 2014
2 parents 68d285a + 1388d26 commit a794924
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -88,6 +88,13 @@ and valid options see the autoprefixer [projectpage](https://github.com/ai/autop
If you wish to support IE9 and the last 2 versions of every browser
you should provide the options like this: `--autoprefixer "ie > 8, last 2 versions"`.

#### --jsxtransform

If this value is set, JSX code (used in
[facebook/react](https://github.com/facebook/react) will be compiled
to javascript on the way out. Using
[express-jsxtransform](https://github.com/gustavnikolaj/express-jsxtransform).

#### --processimage

Process images on the server according to the query string using using <a
Expand Down
6 changes: 6 additions & 0 deletions bin/livestyle
Expand Up @@ -27,6 +27,11 @@ var express = require('express'),
.options('autoprefixer', {
describe: 'If this flag is set the express-autoprefixer middleware is added to the stack (adds missing vendor prefixes to text/css files). If will use the defaults from the autoprefixer module if you provide no options. You can provide options as a string. Fx: "ie > 8, last 2 versions".',
})
.options('jsxtransform', {
type: 'boolean',
describe: 'Compile facebook React JSX to JS on the way out.',
default: false
})
.options('processimage', {
alias: 'processimages',
type: 'boolean',
Expand Down Expand Up @@ -109,6 +114,7 @@ var server = require('../lib/createLiveStyleApp')({
root: root,
compiless: commandLineOptions.compiless,
autoprefixer: commandLineOptions.autoprefixer,
jsxtransform: commandLineOptions.jsxtransform,
processImage: commandLineOptions.processimage,
mappings: mappings,
proxy: commandLineOptions.proxy || null
Expand Down
5 changes: 5 additions & 0 deletions lib/createLiveStyleApp.js
Expand Up @@ -2,6 +2,7 @@ var URL = require('url'),
express = require('express'),
request = require('request'),
compiless = require('express-compiless'),
jsxtransform = require('express-jsxtransform'),
autoprefixer = require('express-autoprefixer'),
processImage = require('express-processimage');

Expand Down Expand Up @@ -48,6 +49,10 @@ module.exports = function createLiveStyleApp(options) {
app.use(compiless({root: options.root}));
}

if (options.jsxtransform) {
app.use(jsxtransform());
}

if (options.autoprefixer) {
var autoprefixerOptions = {};
if (typeof options.autoprefixer === 'string') {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -25,6 +25,7 @@
"express-autoprefixer": "=0.0.6",
"express-compiless": "=0.4.0",
"express-hijackresponse": "=0.1.2",
"express-jsxtransform": "=0.0.1",
"express-processimage": "=0.1.16",
"optimist": "=0.3.0",
"request": "=2.9.3",
Expand Down

0 comments on commit a794924

Please sign in to comment.