-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (32 loc) · 1.01 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
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var cssnano = require('gulp-cssnano');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var rename = require('gulp-rename');
gulp.task('workflow', function () {
gulp.src('./src/scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('./dist/css/')) // unminified
.pipe(cssnano({
zindex: false
}))
.pipe(sourcemaps.write('./'))
.pipe(rename(function (path) {
if(path.extname === '.css') {
path.basename += '.min';
}
}))
.pipe(gulp.dest('./dist/css/'))
.pipe(gulp.dest('./docs/css/')) // comment out for production
});
//Watch task
gulp.task('default', function () {
gulp.watch('./src/scss/**/*.scss', ['workflow']);
});