-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
67 lines (63 loc) · 2.28 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const prop = require('./package.json');
const minify = require('gulp-minify-css');
const $ = require('gulp-load-plugins')();
const head =
'/*\r\n* Cirrus Reset ' +
prop.version +
`\r\n* Stanley Lim, Copyright ${new Date().getFullYear()}\r\n* https://github.com/Cirrus-UI/Cirrus-Reset\r\n*/\r\n`;
gulp.task('compile', () => {
return gulp
.src(['./src/**/*.scss'])
.pipe(sass().on('error', sass.logError))
.pipe($.concat('reset.css'))
.pipe($.header(head))
.pipe($.size())
.pipe(gulp.dest('./dist/'));
});
gulp.task('compile:watch', () => {
gulp.watch('./src/**/*.scss', ['sass']);
});
gulp.task(
'minify',
gulp.series('compile', () => {
return gulp
.src(['./dist/reset.css'])
.pipe(
minify(
{
level: {
1: {
all: true,
normalizeUrls: false,
},
2: {
all: false,
removeDuplicateRules: true,
reduceNonAdjacentRules: true,
removeDuplicateFontRules: true,
removeDuplicateMediaBlocks: true,
mergeAdjacentRules: true,
mergeIntoShorthands: true,
mergeMedia: true,
mergeNonAdjacentRules: true,
mergeSemantically: false,
removeEmpty: true,
},
},
},
(details) => {
console.log(details.name + ': ' + details.stats.originalSize);
console.log(details.name + '-min: ' + details.stats.minifiedSize);
}
)
)
.pipe($.header(head))
.pipe($.size())
.pipe($.concat('reset.min.css'))
.pipe(gulp.dest('./dist/'));
})
);
gulp.task('default', gulp.series('minify'));