├── .gitignore ├── README.md ├── index.coffee ├── index.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/d866fb556184cc1edffd9d0f1ca205fe1916a7f6/Node.gitignore 2 | 3 | # Logs 4 | logs 5 | *.log 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 19 | .grunt 20 | 21 | # node-waf configuration 22 | .lock-wscript 23 | 24 | # Compiled binary addons (http://nodejs.org/api/addons.html) 25 | build/Release 26 | 27 | # Dependency directory 28 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 29 | node_modules 30 | 31 | 32 | ### https://raw.github.com/github/gitignore/d866fb556184cc1edffd9d0f1ca205fe1916a7f6/Global/OSX.gitignore 33 | 34 | .DS_Store 35 | .AppleDouble 36 | .LSOverride 37 | 38 | # Icon must end with two \r 39 | Icon 40 | 41 | # Thumbnails 42 | ._* 43 | 44 | # Files that might appear on external disk 45 | .Spotlight-V100 46 | .Trashes 47 | 48 | # Directories potentially created on remote AFP share 49 | .AppleDB 50 | .AppleDesktop 51 | Network Trash Folder 52 | Temporary Items 53 | .apdisk 54 | 55 | 56 | ### https://raw.github.com/github/gitignore/d866fb556184cc1edffd9d0f1ca205fe1916a7f6/Ruby.gitignore 57 | 58 | *.gem 59 | *.rbc 60 | /.config 61 | /coverage/ 62 | /InstalledFiles 63 | /pkg/ 64 | /spec/reports/ 65 | /test/tmp/ 66 | /test/version_tmp/ 67 | /tmp/ 68 | 69 | ## Specific to RubyMotion: 70 | .dat* 71 | .repl_history 72 | build/ 73 | 74 | ## Documentation cache and generated files: 75 | /.yardoc/ 76 | /_yardoc/ 77 | /doc/ 78 | /rdoc/ 79 | 80 | ## Environment normalisation: 81 | /.bundle/ 82 | /lib/bundler/man/ 83 | 84 | # for a library or gem, you might want to ignore these files since the code is 85 | # intended to run in multiple environments; otherwise, check them in: 86 | # Gemfile.lock 87 | # .ruby-version 88 | # .ruby-gemset 89 | 90 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 91 | .rvmrc 92 | 93 | 94 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gulp-react-jade 2 | 3 | For [jadejs/react-jade](https://github.com/jadejs/react-jade "jadejs/react-jade") 4 | 5 | ``` 6 | npm install @mizchi/gulp-react-jade 7 | ``` 8 | 9 | ## Example 10 | 11 | ```coffee 12 | require 'gulp-react-jade' 13 | gulp.task 'raect-jade', -> 14 | gulp.src('src/**/*.jade') 15 | .pipe jade() 16 | .pipe(gulp.dest('lib')) 17 | ``` 18 | 19 | ## CAUTION 20 | 21 | https://www.npmjs.com/package/gulp-react-jade is for [duncanbeevers/jade-react](https://github.com/duncanbeevers/jade-react "duncanbeevers/jade-react")) 22 | 23 | `npm install gulp-react-jade` target is that one, not me. 24 | -------------------------------------------------------------------------------- /index.coffee: -------------------------------------------------------------------------------- 1 | jade = require 'react-jade' 2 | through = require 'through2' 3 | replaceExt = require 'replace-ext' 4 | 5 | module.exports = (opt) -> 6 | stream = through.obj (file, enc, callback) -> 7 | if file.isNull() 8 | @push(file) 9 | return callback() 10 | else if file.isBuffer() 11 | templateString = jade.compileClient(file.contents.toString(), opt).toString() 12 | file.contents = new Buffer 'module.exports = ' + templateString 13 | file.path = replaceExt(file.path, '.js') 14 | @push(file) 15 | return callback() 16 | else if file.isStream() 17 | throw new Error('Streams are not supported') 18 | return callback() 19 | return stream 20 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.8.0 2 | (function() { 3 | var jade, replaceExt, through; 4 | 5 | jade = require('react-jade'); 6 | 7 | through = require('through2'); 8 | 9 | replaceExt = require('replace-ext'); 10 | 11 | module.exports = function(opt) { 12 | var stream; 13 | stream = through.obj(function(file, enc, callback) { 14 | var templateString; 15 | if (file.isNull()) { 16 | this.push(file); 17 | return callback(); 18 | } else if (file.isBuffer()) { 19 | templateString = jade.compileClient(file.contents.toString(), opt).toString(); 20 | file.contents = new Buffer('module.exports = ' + templateString); 21 | file.path = replaceExt(file.path, '.js'); 22 | this.push(file); 23 | return callback(); 24 | } else if (file.isStream()) { 25 | throw new Error('Streams are not supported'); 26 | } 27 | return callback(); 28 | }); 29 | return stream; 30 | }; 31 | 32 | }).call(this); 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@mizchi/gulp-react-jade", 3 | "version": "1.0.5", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "react": "^0.12.2", 13 | "react-jade": "mizchi/react-jade#127588f991009a94c8dab7a0325dc6c05ab6d245", 14 | "replace-ext": "0.0.1", 15 | "through2": "^0.6.3" 16 | } 17 | } 18 | --------------------------------------------------------------------------------