-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
43 lines (36 loc) · 1.11 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
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const webpack = require('webpack-stream');
const imagemin = require('gulp-imagemin');
const htmlmin = require('gulp-htmlmin');
gulp.task('scss', function () {
gulp.src('./public/scss/main.scss')
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(gulp.dest('./public/dist/assets/css'));
});
gulp.task('webpack', function () {
gulp.src('./public/dist/js/main.js')
.pipe(webpack(require('./webpack.config.js')))
.pipe(gulp.dest('./public/dist/assets/js'));
});
gulp.task('min-svg', function () {
gulp.src('./public/svg/*.svg')
.pipe(imagemin())
.pipe(gulp.dest('./public/dist/assets/svg'));
});
gulp.task('min-html', function () {
gulp.src('./public/index.html')
.pipe(htmlmin({ collapseWhispace: true }))
.pipe(gulp.dest('./public/dist'));
});
gulp.task('default', ['scss', 'webpack', 'min-svg', 'min-html']);
gulp.task('watch', () => {
gulp.watch(
[
'./public/scss/*.scss',
'./public/js/*.js',
'./public/index.html'
],
['scss', 'webpack', 'min-html']);
});