forked from wangshijun/angular-bootstrap-chosen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
64 lines (52 loc) · 1.64 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
'use strict';
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
gulp.task('lint', function () {
gulp.src(['./src/js/*.js'])
.pipe(plugins.jshint('.jshintrc'))
.pipe(plugins.jshint.reporter('jshint-stylish'));
// gulp.src(['./src/css/*.css'])
// .pipe(plugins.csslint('.csslintrc'))
// .pipe(plugins.csslint.reporter());
});
/**
* build Tasks
*/
gulp.task('build', ['lint'], function () {
var files = [
'dist/css/*.css',
'dist/js/*.js',
'dist/img/*.{gif,png,jpg}'
];
// cleanup previous builds
gulp.src(files, {read: false})
.pipe(plugins.clean());
var dists = {
js: 'dist/js/',
css: 'dist/css/',
img: 'dist/img/',
};
// build js
gulp.src(['src/js/*.js'])
.pipe(plugins.concat('chosen.js'))
.pipe(plugins.removeUseStrict())
.pipe(gulp.dest(dists.js))
.pipe(plugins.rename({ suffix: '.min'}))
.pipe(plugins.uglify({ outSourceMap: true, mangle: true, report: 'gzip' }))
.pipe(plugins.size({ showFiles: true }))
.pipe(gulp.dest(dists.js));
// build css
gulp.src(['src/css/*.css'])
.pipe(plugins.concat('chosen.css'))
.pipe(gulp.dest(dists.css))
.pipe(plugins.rename({ suffix: '.min'}))
.pipe(plugins.minifyCss())
.pipe(plugins.size({ showFiles: true }))
.pipe(gulp.dest(dists.css));
gulp.src(['src/img/*.{gif,png,jpg}'])
.pipe(gulp.dest(dists.img));
// bump bower, npm versions
gulp.src(['package.json', 'bower.json'])
.pipe(plugins.bump())
.pipe(gulp.dest('.'));
});