├── .gitignore ├── LICENSE ├── README.md ├── index.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /.idea 3 | /node_modules 4 | /vendor 5 | 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ryan Winchester (fungku) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel Elixir - React JSX transforming 2 | 3 | [![Version](https://img.shields.io/npm/v/elixir-react-jsx.svg?style=flat-square)](https://www.npmjs.com/package/elixir-react-jsx) 4 | [![License](https://img.shields.io/npm/l/elixir-react-jsx.svg?style=flat-square)](https://www.npmjs.com/package/elixir-react-jsx) 5 | [![Monthly downloads](https://img.shields.io/npm/dm/elixir-react-jsx.svg?style=flat-square)](https://www.npmjs.com/package/elixir-react-jsx) 6 | 7 | ## No longer being maintained! 8 | 9 | I'll merge PRs as you want, but it would be better to fork. 10 | 11 | ## Install 12 | 13 | `npm install elixir-react-jsx --save-dev` 14 | 15 | Then require `elixir-react-jsx` in your gulpfile, and you can use `mix.jsx()`. 16 | 17 | Pretty simple. 18 | 19 | ```js 20 | var elixir = require('laravel-elixir'); 21 | 22 | require('elixir-react-jsx'); 23 | 24 | elixir(function(mix) { 25 | 26 | mix.jsx(); 27 | 28 | }); 29 | ``` 30 | 31 | By default, using `mix.js()` without any arguments is the same as using: 32 | 33 | ```js 34 | mix.jsx('resources/assets/jsx/*.jsx', 'public/js'); 35 | ``` 36 | 37 | Arguments: 38 | 39 | - input src 40 | - output dest 41 | 42 | ### Transforming all your jsx files, and saving them to **public/js** 43 | 44 | ```js 45 | var src = 'resources/assets/jsx/*.jsx'; 46 | 47 | mix.jsx(src); 48 | ``` 49 | 50 | ### Transforming all your jsx files, and saving them to **public/react** 51 | 52 | ```js 53 | var src = 'resources/assets/jsx/*.jsx'; 54 | var dest = 'public/react'; 55 | 56 | mix.jsx(src, dest); 57 | ``` 58 | 59 | ### Concatenating all your jsx files to one js file 60 | 61 | ```js 62 | var src = 'resources/assets/jsx/*.jsx'; 63 | var dest = 'public/js/app-react.js'; 64 | 65 | mix.jsx(src, dest); 66 | ``` 67 | 68 | 69 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var Elixir = require('laravel-elixir'); 2 | var gulp = require('gulp'); 3 | var gulpif = require('gulp-if'); 4 | var react = require('gulp-react'); 5 | var concat = require('gulp-concat'); 6 | 7 | Elixir.extend("jsx", function(src, dest) { 8 | src = src || 'resources/assets/jsx/*.jsx'; 9 | dest = dest || 'public/js'; 10 | 11 | var doConcat = ~dest.indexOf('.js'); 12 | 13 | new Elixir.Task("jsx", function() { 14 | return gulp.src(src) 15 | .pipe(react()) 16 | .pipe(gulpif(doConcat, concat(dest))) 17 | .pipe(gulp.dest(dest)); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "elixir-react-jsx", 3 | "version": "3.0.0", 4 | "description": "Laravel Elixir extension to transform React JSX", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/fungku/elixir-jsx.git" 12 | }, 13 | "keywords": [ 14 | "laravel", 15 | "elixir", 16 | "gulp", 17 | "react", 18 | "jsx" 19 | ], 20 | "author": "Ryan Winchester (fungku) ", 21 | "license": "MIT", 22 | "dependencies": { 23 | "gulp-concat": "^2.5.2", 24 | "gulp-if": "^1.2.5", 25 | "gulp-react": "^3.0.1" 26 | }, 27 | "bugs": { 28 | "url": "https://github.com/fungku/elixir-react-jsx/issues" 29 | }, 30 | "homepage": "https://github.com/fungku/elixir-react-jsx" 31 | } 32 | --------------------------------------------------------------------------------