-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
31 lines (28 loc) · 897 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
// const gulp = require('gulp');
const { src, dest, parallel, watch } = require('gulp');
const sass = require('gulp-sass');
const rename = require('gulp-rename');
const postcss = require('gulp-postcss');
sass.compiler = require('node-sass');
function postCSS() {
return src('./src/*.scss')
.pipe(sass.sync({outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(postcss([
require('autoprefixer'),
]))
.pipe(dest('./dist'));
}
function postCSSmin() {
return src('./src/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(postcss([
require('autoprefixer'),
require('cssnano')
]))
.pipe(rename({ suffix: '.min' }))
.pipe(dest('./dist'));
}
exports.build = parallel(postCSS, postCSSmin);
exports.watch = function() {
watch('./src/*.scss', parallel(postCSS, postCSSmin));
}