forked from tatthien-zz/vue-todo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (48 loc) · 1.17 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
48
49
50
51
52
53
54
var gulp = require('gulp');
var sass = require('gulp-sass');
var minifyCSS = require('gulp-minify-css');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
/**
* Compile sass
*/
var sassPath = 'src/sass/**/*.scss';
gulp.task('sass', function() {
return gulp.src(sassPath)
.pipe(sass())
.pipe(minifyCSS())
.pipe(gulp.dest('dist/css'))
.pipe(browserSync.stream());
});
/**
* Concat js
*/
var jsPath = 'src/js/**/*.js';
gulp.task('scripts', function() {
return gulp.src(jsPath)
//.pipe(concat('script.js'))
//.pipe(gulp.dest('dist/js'))
//.pipe(rename('script.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'))
.pipe(browserSync.stream())
});
/**
* Watcher
*/
gulp.task('watch', function() {
browserSync.init({
server: {
baseDir: "./"
}
});
var templateFiles = [
'**/*.html'
];
gulp.watch(templateFiles).on("change", reload);
gulp.watch(sassPath, ['sass']);
gulp.watch(jsPath, ['scripts']);
});