-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (35 loc) · 1 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
const gulp = require('gulp')
const sass = require('gulp-sass')
const shelljs = require('shelljs')
const browserSync = require('browser-sync').create()
const reload = browserSync.reload
// 静态服务器
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: './generate-output/html'
}
})
})
function compileSass() {
gulp.src('src/genetation/html-template/0/src/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('generate-output/html/css'))
}
gulp.task('compile', function() {
shelljs.exec('cnpm start')
compileSass()
var watcher = gulp.watch('src/genetation/**/!(*.json|get.var.js)')
watcher.on('change', function(event) {
console.log('ReCompiled Temaplate....')
shelljs.exec('cnpm start')
compileSass()
reload()
})
})
// gulp.task('sass', ['compile'], () =>
// sass('src/genetation/html-template/0/src/scss/*.scss')
// .on('error', sass.logError)
// .pipe(gulp.dest('generate-output/html/css'))
// );
gulp.task('default', ['compile', 'browser-sync'])