-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
41 lines (31 loc) · 961 Bytes
/
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
var gulp = require('gulp');
var sass = require('gulp-dart-sass');
var prefix = require('gulp-autoprefixer');
var cleanCSS = require('gulp-clean-css');
var rename = require('gulp-rename');
var rimraf = require('rimraf');
gulp.task('clean', (cb) => {
rimraf('dist', cb);
});
gulp.task('sass', () => {
return gulp.src('src/sass/main.scss')
.pipe(sass())
.pipe(prefix('last 1 version', '> 1%'))
.pipe(gulp.dest('dist/css')
);
});
gulp.task('build-min', () => {
return gulp.src('src/sass/main.scss')
.pipe(sass())
.pipe(prefix('last 1 version', '> 1%'))
.pipe(cleanCSS())
.pipe(rename('main.min.css'))
.pipe(gulp.dest('dist/css'));
});
gulp.task('watch', () => {
gulp.watch('src/sass/**/*.scss', ['sass']);
});
gulp.task('runbuild', gulp.series('sass', 'build-min'));
gulp.task('build', gulp.series('clean', 'runbuild'));
gulp.task('dev', gulp.series('sass', 'watch'));
gulp.task('default', gulp.series('clean', 'dev'));