well done. (y)
Mar 30, 2015
8
Level 3
[package] Laravel Elixir + React.js JSX transformer
Hey guys I made an elixir extension for transforming JSX files :D
https://github.com/fungku/elixir-react-jsx
You can see the readme below, and an example of it in use here
Completely open to suggestions on improvements to make it easier for more people to use. I just made it easy for me, personally.
Laravel Elixir - React JSX transforming
npm install elixir-react-jsx --save-dev
Then require elixir-react-jsx in your gulpfile, and you can use mix.jsx().
Pretty simple.
var elixir = require('laravel-elixir');
require('elixir-react-jsx');
elixir(function(mix) {
mix.jsx();
});
By default, using mix.js() without any arguments is the same as using:
mix.jsx('resources/assets/jsx/*.jsx', 'public/js');
Arguments:
- input src
- output dest
Transforming all your jsx files, and saving them to public/js
var src = 'resources/assets/jsx/*.jsx';
mix.jsx(src);
Transforming all your jsx files, and saving them to public/react
var src = 'resources/assets/jsx/*.jsx';
var dest = 'public/react';
mix.jsx(src, dest);
Concatenating all your jsx files to one js file
var src = 'resources/assets/jsx/*.jsx';
var dest = 'public/js/app-react.js';
mix.jsx(src, dest);
edit: Updated to 2.0 today, still testing it out. Use 1.1 to continue using 3 arguments and old functionality...
Please or to participate in this conversation.