-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
42 lines (38 loc) · 1.18 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
"use strict";
const gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const prefix = require('gulp-autoprefixer');
const minify = require('gulp-clean-css');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
gulp.task('dev', function () {
return gulp
.src('./piment/**/*.scss')
.pipe(sass())
.pipe(prefix())
.pipe(gulp.dest('public/assets/css')); // .css
});
gulp.task('build', function () {
return gulp
.src('./piment/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(prefix())
.pipe(gulp.dest('public/assets/css')) // .css
.pipe(minify())
.pipe(
rename(function (path) {
return {
dirname: path.dirname + '',
basename: path.basename + '.min',
extname: '.css'
}
})
)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('public/assets/css')); // .min.css
});
gulp.task('watch', function () {
gulp.watch(['piment/**/*.scss'], gulp.series('dev'))
});
gulp.task("default", gulp.series(['build', 'watch']));