1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-01-10 12:24:20 +01:00

finally fixed watchify

This commit is contained in:
Enrico Fasoli 2015-11-16 12:21:29 +01:00
parent a5b33ca6bc
commit c264bc7fd6
2 changed files with 16 additions and 10 deletions

View File

@ -8,6 +8,7 @@ var clean = require('gulp-clean')
var exorcist = require('exorcist') var exorcist = require('exorcist')
var connect = require('gulp-connect') var connect = require('gulp-connect')
var watchify = require('watchify') var watchify = require('watchify')
var util = require('gulp-util')
var config = { var config = {
files: { files: {
@ -33,27 +34,31 @@ gulp.task('html',function(){
.pipe(connect.reload()) .pipe(connect.reload())
}) })
gulp.task('js',function(){
return applyBrowserify(getBrowserify())
})
gulp.task('js-watch',function(){ gulp.task('js-watch',function(){
var b = watchify(getBrowserify()) var b = getBrowserify()
b.on('log',function(l){
util.log(l)
})
b.on('error',function(error){ b.on('error',function(error){
console.log(error) util.log(error)
}) })
b.on('update', function(){ b.on('update', function(){
console.log('Rebundling') util.log('Rebundling')
applyBrowserify(b) applyBrowserify(b)
}) })
return b return applyBrowserify(b)
})
gulp.task('js',function(){
return applyBrowserify(getBrowserify())
}) })
function getBrowserify(){ function getBrowserify(){
return browserify(config.files.mainJs, { return browserify(config.files.mainJs, {
cache: {}, cache: {},
packageCache: {}, packageCache: {},
fullPaths: true, plugin: [watchify],
//fullPaths: true,
debug: true }) debug: true })
.transform('babelify', { .transform('babelify', {
global: true, global: true,
@ -92,6 +97,6 @@ gulp.task('watch',['js-watch'],function(){
gulp.watch(config.files.css,['css']) gulp.watch(config.files.css,['css'])
}) })
gulp.task('serve', [ 'html', 'css', 'js', 'watch', 'server' ]) gulp.task('serve', [ 'html', 'css', 'watch', 'server' ])
gulp.task('default', [ 'html', 'css', 'js' ]) gulp.task('default', [ 'html', 'css', 'js' ])

View File

@ -34,6 +34,7 @@
"gulp-connect": "^2.2.0", "gulp-connect": "^2.2.0",
"gulp-minify-css": "^1.2.1", "gulp-minify-css": "^1.2.1",
"gulp-uglify": "^1.5.1", "gulp-uglify": "^1.5.1",
"gulp-util": "^3.0.7",
"history": "^1.13.1", "history": "^1.13.1",
"ipfs-api": "^2.6.2", "ipfs-api": "^2.6.2",
"moment": "^2.10.6", "moment": "^2.10.6",