Last active
November 15, 2017 11:55
-
-
Save Sigmus/9253068 to your computer and use it in GitHub Desktop.
Revisions
-
Sigmus revised this gist
Jul 9, 2014 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,8 +6,8 @@ var reactify = require('reactify'); var watchify = require('watchify'); var notify = require("gulp-notify"); var scriptsDir = './scripts'; var buildDir = './build'; function handleErrors() { @@ -22,14 +22,14 @@ function handleErrors() { // Based on: http://blog.avisi.nl/2014/04/25/how-to-keep-a-fast-build-with-browserify-and-reactjs/ function buildScript(file, watch) { var props = {entries: [scriptsDir + '/' + file]}; var bundler = watch ? watchify(props) : browserify(props); bundler.transform(reactify); function rebundle() { var stream = bundler.bundle({debug: true}); return stream.on('error', handleErrors) .pipe(source(file)) .pipe(gulp.dest(buildDir + '/')); } bundler.on('update', function() { rebundle(); -
Sigmus revised this gist
Jul 9, 2014 . 2 changed files with 54 additions and 27 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,49 @@ var source = require('vinyl-source-stream'); var gulp = require('gulp'); var gutil = require('gulp-util'); var browserify = require('browserify'); var reactify = require('reactify'); var watchify = require('watchify'); var notify = require("gulp-notify"); var scriptDir = './scripts'; var buildDir = './build/'; function handleErrors() { var args = Array.prototype.slice.call(arguments); notify.onError({ title: "Compile Error", message: "<%= error.message %>" }).apply(this, args); this.emit('end'); // Keep gulp from hanging on this task } // Based on: http://blog.avisi.nl/2014/04/25/how-to-keep-a-fast-build-with-browserify-and-reactjs/ function buildScript(file, watch) { var props = {entries: ['./scripts/' + file]}; var bundler = watch ? watchify(props) : browserify(props); bundler.transform(reactify); function rebundle() { var stream = bundler.bundle({debug: true}); return stream.on('error', handleErrors) .pipe(source(file)) .pipe(gulp.dest('./build/')); } bundler.on('update', function() { rebundle(); gutil.log('Rebundle...'); }); return rebundle(); } gulp.task('build', function() { return buildScript('main.js', false); }); gulp.task('default', ['build'], function() { return buildScript('main.js', true); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,22 @@ { "name": "scripts", "version": "0.0.0", "description": "", "main": "gulpfile.js", "devDependencies": { "envify": "~1.2.1", "react": "~0.10.0", "browserify": "~4.2.0", "gulp": "~3.8.5", "gulp-notify": "~1.4.0", "gulp-util": "~2.2.19", "reactify": "~0.13.1", "vinyl-source-stream": "~0.1.1", "watchify": "~0.10.2" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "BSD-2-Clause" } -
Sigmus revised this gist
Mar 22, 2014 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,11 +5,12 @@ var browserify = require('gulp-browserify'); gulp.task('build', function() { gulp.src('./scripts/main.js', {read: false}) .pipe(browserify({ transform: ['reactify'], // implies that the module 'reactify' is installed extensions: ['.jsx'] // you can omit the extension when requiring })) .on('prebundle', function(bundle) { // any module requiring underscore will get lodash instead (e.g. Backbone) bundle.require('lodash', {expose: 'underscore'}); }) .on('error', gutil.log) .on('error', gutil.beep) @@ -18,7 +19,7 @@ gulp.task('build', function() { gulp.task('watch', function() { gulp.watch('./scripts/**/*.js', ['build']); }); -
Sigmus revised this gist
Mar 6, 2014 . 2 changed files with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,13 +8,18 @@ gulp.task('build', function() { transform: ['reactify'], extensions: ['.jsx'] })) .on('prebundle', function(bundle) { bundle.require('lodash', {expose: 'underscore'}); }) .on('error', gutil.log) .on('error', gutil.beep) .pipe(gulp.dest('./build/')) }); gulp.task('watch', function() { gulp.watch('./scripts/**', ['build']); }); gulp.task('default', ['build', 'watch']) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,7 @@ "gulp": "~3.5.2", "gulp-util": "~2.2.14", "gulp-browserify": "~0.4.6", "reactify": "~0.8.1", "lodash": "~2.4.1" } } -
Sigmus revised this gist
Feb 27, 2014 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,10 +13,8 @@ gulp.task('build', function() { .pipe(gulp.dest('./build/')) }); gulp.task('watch', function() { gulp.watch('./scripts/**', ['build']); }); gulp.task('default', ['build', 'watch']) -
Sigmus revised this gist
Feb 27, 2014 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ { "name": "gulp example", "version": "0.0.0", "description": "", "main": "gulpfile.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "BSD-2-Clause", "devDependencies": { "gulp": "~3.5.2", "gulp-util": "~2.2.14", "gulp-browserify": "~0.4.6", "reactify": "~0.8.1" } } -
Sigmus created this gist
Feb 27, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ var gulp = require('gulp'); var gutil = require('gulp-util'); var browserify = require('gulp-browserify'); gulp.task('build', function() { gulp.src('./scripts/main.js', {read: false}) .pipe(browserify({ transform: ['reactify'], extensions: ['.jsx'] })) .on('error', gutil.log) .on('error', gutil.beep) .pipe(gulp.dest('./build/')) }); gulp.task('watch', function() { gulp.watch('./scripts/**', ['build']); }); gulp.task('default', ['build', 'watch'])