-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (39 loc) · 1.03 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
const gulp = require('gulp');
const del = require('del');
const webpack = require('webpack');
const webpackStream = require('webpack-stream');
const webpackConfig = require('./config/webpack.config.js');
const named = require('vinyl-named');
const vueify = require('gulp-vueify2');
const sass = require('gulp-sass')(require('sass'));
// Clean assets
function clean() {
return del(['dist/']);
}
// SASS task
function scss() {
return gulp
.src('src/scss/index.scss')
.pipe(sass())
.pipe(gulp.dest('dist/css/'));
}
// JS & VUE task
function js() {
return gulp
.src('src/main.js')
.pipe(named())
.pipe(vueify())
.pipe(webpackStream(webpackConfig), webpack)
.pipe(gulp.dest('dist/'));
}
// Watch files
function watchFiles() {
gulp.watch('src/scss/**/*', scss);
gulp.watch('src/main.js', js);
gulp.watch('src/store/index.js', js);
gulp.watch('src/**/*.vue', js);
}
const build = gulp.series(clean, gulp.parallel(scss, js));
const watch = gulp.parallel(watchFiles);
exports.build = build;
exports.watch = watch;