This repository has been archived by the owner on Apr 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
61 lines (53 loc) · 1.43 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
var gulp = require('gulp');
var cleancss = require('gulp-clean-css');
var csscomb = require('gulp-csscomb');
var csslint = require('gulp-csslint');
var rename = require('gulp-rename');
var header = require('gulp-header');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var paths = {
source: './src/*.css'
};
var pkg = require('./package.json');
var banner = ['/*!',
' * Suka.css v<%= pkg.version %>',
' * Author <%= pkg.author %>',
' * Link <%= pkg.homepage %>',
' * License <%= pkg.license %>',
' */\n',
''].join('\n');
var configs = {
autoprefixer: {
browsers: [
'last 2 versions',
'> 1%',
'Chrome >= 30',
'Firefox >= 30',
'ie >= 9',
'Safari >= 8',
],
},
cleanCSS: {
compatibility: 'ie9'
},
};
gulp.task('watch', function() {
gulp.watch(paths.source, gulp.parallel('build'));
});
gulp.task('build', () => {
return gulp.src(paths.source)
.pipe(concat('suka.css'))
.pipe(header(banner, { pkg : pkg } ))
.pipe(autoprefixer(configs.autoprefixer))
.pipe(csscomb())
.pipe(csslint())
.pipe(csslint.formatter())
.pipe(gulp.dest('./dist'))
.pipe(cleancss(configs.cleanCSS))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./dist'));
});
gulp.task('default', gulp.parallel('build'));