forked from animachine/animachine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
70 lines (61 loc) · 2.05 KB
/
gulpfile.js
File metadata and controls
70 lines (61 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
var gulp = require('gulp')
var gutil = require('gulp-util')
var size = require('gulp-size')
var zip = require('gulp-zip')
var webpack = require('webpack')
var WebpackDevServer = require('webpack-dev-server')
var demoWebpackConfig = require('./demo/webpack.config.dev.js')
var browserWebpackConfig = require('./webpack.browser.config.dev.js')
var ghPages = require('gulp-gh-pages')
gulp.task('default', ['webpack-dev-server'])
gulp.task('webpack-dev-server', function(callback) {
// modify some webpack config options
var myConfig = Object.create(demoWebpackConfig)
myConfig.devtool = '#eval-source-map'
myConfig.debug = true
// Start a webpack-dev-server
new WebpackDevServer(webpack(myConfig), {
publicPath: '/',//myConfig.output.publicPath,
// hot: true,
historyApiFallback: true,
stats: {
colors: true
}
}).listen(5435, 'localhost', function(err) {
if(err) throw new gutil.PluginError('webpack-dev-server', err)
gutil.log('[webpack-dev-server]', 'http://localhost:5435/webpack-dev-server/index.html')
})
})
gulp.task('pack-extension', function () {
return gulp.src('chrome/src/**/*.*')
.pipe(zip('build_chrome.zip'))
.pipe(size())
.pipe(gulp.dest('./'))
})
// gulp.task('build-browser', function (callback) {
// webpack(browserWebpackConfig, function(err, stats) {
// if(err) throw new gutil.PluginError('build-demo', err)
// gutil.log('[webpack:build]', stats.toString({
// colors: true
// }))
// callback()
// })
// })
gulp.task('serve-browser', function(callback) {
// modify some webpack config options
var myConfig = Object.create(browserWebpackConfig)
myConfig.devtool = '#eval-source-map'
myConfig.debug = true
// Start a webpack-dev-server
new WebpackDevServer(webpack(myConfig), {
publicPath: '/',//myConfig.output.publicPath,
// hot: true,
historyApiFallback: true,
stats: {
colors: true
}
}).listen(5436, 'localhost', function(err) {
if(err) throw new gutil.PluginError('webpack-dev-server', err)
gutil.log('[webpack-dev-server]', 'http://localhost:5436/webpack-dev-server/index.html')
})
})