-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.babel.js
66 lines (58 loc) · 1.59 KB
/
gulpfile.babel.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import plugin from './package.json';
import gulp from 'gulp';
import plugins from 'gulp-load-plugins';
import runSequence from 'run-sequence';
const $ = plugins();
gulp.task('dist:css', (done) => {
const CSSNANO = {
autoprefixer: false,
calc: false,
colormin: true,
convertValues: false,
discardComments: true,
discardDuplicates: false,
discardEmpty: true,
discardUnused: false,
filterPlugins: false,
mergeIdents: false,
mergeLonghand: false,
mergeRules: false,
minifyFontValues: true,
minifyGradients: false,
minifySelectors: true,
normalizeCharset: false,
normalizeUrl: false,
orderedValues: false,
reduceIdents: false,
reduceTransforms: false,
svgo: true,
uniqueSelectors: false,
zindex: false
};
const processors = [
require('cssnano')(CSSNANO),
require('postcss-reporter')({clearReportedMessages: true})
];
return gulp.src('assets/css/input.css')
.pipe($.postcss(processors))
.pipe($.rename({suffix: '.min'}))
.pipe(gulp.dest('assets/css'));
});
gulp.task('dist:js', (done) => {
return gulp.src('assets/js/input.js')
.pipe($.uglify({output: {comments: /^!|@preserve|@license|@cc_on/i}}))
.pipe($.rename({suffix: '.min'}))
.pipe(gulp.dest('assets/js'));
});
gulp.task('dist', ['check:js'], (done) => {
runSequence(
['dist:css'],
['dist:js'],
done
);
});
gulp.task('check:js', (done) => {
return gulp.src('assets/js/input.js')
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'));
});