forked from hustcer/star
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gulpfile.js
47 lines (34 loc) · 1.14 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
'use strict'; // eslint-disable-line
/**
* Gulp file for front-end js check and etc.
* Date : 2015/10/21
* copyright : (c) hustcer
*/
let gulp = require('gulp'),
sloc = require('gulp-sloc2'),
eslint = require('gulp-eslint'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant');
gulp.task('check', () => {
let src = ['Gulpfile.js', 'star.js', 'lib/**/*.js'];
return gulp.src(src)
.pipe(eslint({ configFile: 'eslint.json' }))
.pipe(eslint.format('stylish'));
});
gulp.task('sloc', () => {
let src = ['Gulpfile.js', 'star.js', 'lib/**/*.js'];
gulp.src(src).pipe(sloc());
});
gulp.task('opt', () => {
let imgPath = ['snapshot/*'];
return gulp.src(imgPath)
.pipe(imagemin({
progressive : true,
use : [pngquant()],
}))
.pipe(gulp.dest('snapshot/'));
});
let defaultTasks = ['check', 'opt', 'sloc'];
gulp.task('default', defaultTasks, () => {
console.log(`---------> All gulp task has been done! Task List: ${defaultTasks}`);
});