1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-01-10 12:24:20 +01:00
ipfs-boards/gulpfile.js
2015-11-20 20:31:54 +01:00

54 lines
1.2 KiB
JavaScript

var gulp = require('gulp')
var webpack = require('webpack-stream')
var clean = require('gulp-clean')
var connect = require('gulp-connect')
var ghPages = require('gulp-gh-pages')
var config = {
files: {
mainJs: 'webapp/app.jsx',
css: 'webapp/*.css',
js: ['webapp/*.js','webapp/*.jsx'],
html: 'webapp/*.html',
jsLibs: 'lib/*.js'
},
dest: 'webapp/dist/'
}
gulp.task('watch',['clean'],function(){
var cfg = require('./webpack.config.js')
cfg.watch = true
cfg.devtool = 'eval'
return gulp.src(config.files.mainJs)
.pipe(webpack(cfg))
.pipe(gulp.dest(config.dest))
.pipe(connect.reload())
})
gulp.task('build',['clean'],function(){
return gulp.src(config.files.mainJs)
.pipe(webpack(require('./webpack.config.js')))
.pipe(gulp.dest(config.dest))
})
gulp.task('clean',function(){
return gulp.src(config.dest, { read: false }).pipe(clean())
})
gulp.task('server',function(){
connect.server({
root: config.dest,
port: 9090,
livereload: true
})
})
gulp.task('gh-pages',[ 'build' ],function(){
gulp.src([config.dest+'*.js',config.dest+'*.css',config.dest+'*.html'])
.pipe(ghPages())
})
gulp.task('serve', [ 'watch', 'server' ])
gulp.task('default', [ 'build' ])