-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss-min.js
29 lines (25 loc) · 847 Bytes
/
css-min.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
'use strict';
const $ = require('gulp-load-plugins')();
const gulp = require('gulp');
const pump = require('pump'); // https://github.com/gulpjs/gulp/tree/master/docs/why-use-pump
const package_json = require('../package.json'); // https://stackoverflow.com/a/22646149/6263942
module.exports = function(options) {
return function(callback) {
pump([
gulp.src(options.src),
$.if(options.isDevelopment, $.sourcemaps.init()),
$.sass(),
//gulp.dest('app/css'),
$.cssnano({
// autoprefixer: {browsers: ['> 1%', 'last 2 versions', 'ie >= 9'], add: true},
autoprefixer: {browsers: package_json.browserslist, add: true},
}),
$.debug({title: options.taskName}),
$.if(options.isDevelopment, $.sourcemaps.write('.')),
$.rename({suffix: '.min'}),
gulp.dest(options.dest),
],
callback
);
};
};