-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
56 lines (48 loc) · 1.47 KB
/
gulpfile.babel.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
'use strict';
import gulp from 'gulp';
import sass from 'gulp-sass';
import autoprefixer from 'gulp-autoprefixer';
import sourcemaps from 'gulp-sourcemaps';
import notify from 'gulp-notify';
import sassLint from 'gulp-sass-lint';
import del from 'del';
import webpack from 'webpack';
import webpackStream from 'webpack-stream';
import webpackConfig from './webpack.config.js';
const paths = {
sass: './src/sass/**/*.scss',
webpackIndex: './src/js/index.js',
jsDest: './js/'
};
gulp.task('compile:sass', () => {
return gulp.src(paths.sass)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./'))
.pipe(notify({ message: 'TASK: "compile:sass" Completed!', onLast: true }));
});
gulp.task('lint:sass', () => {
return gulp.src(paths.sass)
.pipe(sassLint())
.pipe(sassLint.format())
.pipe(sassLint.failOnError())
});
gulp.task('compile:js', () => {
gulp.src(paths.webpackIndex)
.pipe(webpackStream(webpackConfig), webpack)
.pipe(gulp.dest(paths.jsDest))
.pipe(notify({ message: 'TASK: "compile:js" Completed!', onLast: true }));
});
gulp.task('clean', () => {
return del([
'./style.css',
`${paths.jsDest}/*`,
]);
});
gulp.task('watch', function(){
gulp.watch(paths.sass, ['compile:sass', 'lint:sass']);
gulp.watch(paths.webpackIndex, ['compile:js']);
})
gulp.task('default', ['clean', 'compile:sass', 'lint:sass', 'compile:js', 'watch']);