-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
41 lines (36 loc) · 1.19 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
const gulp = require('gulp');
const pleeease = require('gulp-pleeease');
const cleanCSS = require('gulp-clean-css');
const sass = require('gulp-sass')(require('sass'));
const concat = require('gulp-concat');
const htmlmin = require('gulp-htmlmin');
const webpackStream = require("webpack-stream");
const webpack = require("webpack");
gulp.task('html', function () {
return gulp
.src(['src/index.html'])
.pipe(htmlmin())
.pipe(gulp.dest('dist'));
});
gulp.task('sass', function () {
return gulp
.src(['src/styles/**/*.scss'])
.pipe(sass({
includePaths: ['node_modules']
}))
.pipe(concat('index.min.css'))
.pipe(pleeease()) // autoprefixing
.pipe(cleanCSS()) // minifying
.pipe(gulp.dest('dist'));
});
gulp.task('webpack', function () {
return webpackStream(require('./webpack.config.js'), webpack)
.pipe(gulp.dest('dist'));
});
gulp.task('default', gulp.parallel('html', 'sass', 'webpack'));
gulp.task('watch', function () {
gulp.watch('src/index.html', gulp.parallel('html'));
gulp.watch('src/**/*.scss', gulp.parallel('sass'));
gulp.watch('src/**/*.js', gulp.parallel('webpack'));
gulp.watch('src/**/*.tag.html', gulp.parallel('webpack'));
});