-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (40 loc) · 1.3 KB
/
gulpfile.js
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
var gulp = require('gulp'),
sass = require('gulp-sass'),
shell = require('gulp-shell'),
webpack = require('webpack'),
gulpWebpack = require('webpack-stream'),
webserver = require('gulp-webserver')
gulp.task('static', function() {
return gulp.src('./public/**/*')
.pipe(gulp.dest('./dist'))
})
gulp.task('scss', function () {
return gulp.src('src/scss/main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./dist/css'))
})
gulp.task('webpack', function () {
return gulp.src('./src/js/index.js')
.pipe(gulpWebpack(require('./webpack.config.js'), webpack))
.pipe(gulp.dest('./dist/'));
})
gulp.task('build', ['static', 'scss', 'webpack'])
gulp.task('watch', ['build'], function() {
gulp.watch('public', ['static'])
gulp.watch('src/scss/**/*.scss', ['scss'])
gulp.watch('src/js/**/*.js', ['webpack'])
gulp.watch('src/html/**/*.html', ['webpack'])
gulp.watch('src/json/**/*.json', ['webpack'])
gulp.watch('src/res/**/*.*', ['webpack'])
})
gulp.task('run', ['watch'], shell.task([
'electron .'
]))
gulp.task('serve', ['watch'], function () {
gulp.src('./dist')
.pipe(webserver({
livereload: true,
enable: true,
open: true
}))
})