forked from devWayne/core.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (45 loc) · 1.44 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 plugins = require('gulp-load-plugins')();
var runSequence = require('run-sequence');
var pkg = require('./package.json');
var dirs = pkg['h5bp-configs'].directories;
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('concat:js', function() {
return gulp.src([dirs.src + '/core.js', dirs.src + '/ajax.js', dirs.src + '/event.js'])
.pipe(concat('core.js'))
//.pipe(uglify())
.pipe(gulp.dest(dirs.dist))
});
gulp.task('compress:js', function() {
return gulp.src(dirs.dist + '/core.js')
.pipe(concat('core.min.js'))
.pipe(uglify())
.pipe(gulp.dest(dirs.dist))
});
gulp.task('jshint', function() {
return gulp.src([
'gulpfile.js',
dirs.src + '/*.js'
]).pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
});
// -----------------------------------------------------------------------------
// | Main tasks |
// -----------------------------------------------------------------------------
gulp.task('clean', function(done) {
require('del')([
dirs.dist
], done);
});
gulp.task('build', function(done) {
runSequence(
['clean'],
'concat:js',
'compress:js',
done);
});
gulp.task('watch', function() {
gulp.watch('src/*.js', ['build']);
});
gulp.task('default', ['build']);