-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
66 lines (54 loc) · 1.57 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
55
56
57
58
59
60
61
62
63
64
65
66
var gulp = require('gulp');
var minify = require('gulp-minify');
var sass = require('gulp-sass');
var webpack = require('gulp-webpack');
gulp.task('webpack', function() {
return gulp.src('src/js/main.js')
.pipe(webpack({
watch: true,
output: {
filename: 'app.js',
}
}))
.pipe(gulp.dest('dist/js'));
});
gulp.task('html', function() {
return gulp.src('src/index.html')
.pipe(gulp.dest('dist/'));
});
gulp.task('img', function() {
return gulp.src('src/img/**')
.pipe(gulp.dest('dist/img/'));
});
gulp.task('sass', function () {
return gulp.src('./src/css/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('sass:watch', function () {
gulp.watch('./src/css/**/*.scss', ['sass']);
});
gulp.task('js:watch', function () {
gulp.watch('./src/js/**/*.js', ['webpack']);
});
gulp.task('watch', function() {
gulp.watch('./src/css/**/*.scss', ['sass']);
gulp.watch('./src/js/**/*.js', ['webpack']);
gulp.watch('./src/**/*.html', ['html']);
});
gulp.task('build', ['html', 'sass', 'img']);
// gulp.task('minify', function() {
// gulp.src('src/js/*.js')
// .pipe(minify({
// ext:{
// src:'-debug.js',
// min:'.js'
// },
// //Will not minify files in the dirs.
// // exclude: ['tasks'],
// //Will not minify files which matches the pattern.
// // ignoreFiles: ['.combo.js', '-min.js']
// }))
// .pipe(gulp.dest('dist/js'))
// });
gulp.task('default', ['webpack', 'sass:watch', 'html', 'img']);