-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
95 lines (83 loc) · 2.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')();
var BUILD_PATH = './build/',
JS_LOCATIONS = [
'./lib/*.js'
],
AUTOPREFIXER_BROWSERS = [
'last 2 versions',
'last 5 chrome versions',
'safari >= 5',
'ios >= 6',
'android >= 2',
'ff >= 30',
'opera >= 22',
'ie >= 8',
'ie_mob >= 10'
];
gulp.task('jshint', function () {
return gulp.src(JS_LOCATIONS)
.pipe(plugins.jshint('.jshintrc'))
.pipe(plugins.jshint.reporter('jshint-stylish'));
});
gulp.task('less', function (done) {
gulp.src('styles/less/cards.less')
.pipe(plugins.less({
compress: false
}))
.pipe(plugins.autoprefixer(AUTOPREFIXER_BROWSERS))
.pipe(gulp.dest('public/css'));
done();
});
gulp.task('zepto', function () {
return gulp.src([
'public/js/zepto.js',
'public/js/touch.zepto.js'
])
.pipe(plugins.uglify())
.pipe(plugins.rename({
extname: '.min.js'
}))
.pipe(gulp.dest('public/js'))
});
// format JavaScript based on pretty rules
gulp.task('pretty', function () {
return gulp.src(JS_LOCATIONS, {base: '.'})
.pipe(plugins.jsbeautifier({ config: '.jsbeautifyrc' }))
.pipe(gulp.dest('.'))
});
// bump version
gulp.task('bump', function () {
return gulp.src('./package.json')
.pipe(plugins.bump({type: 'patch'}))
.pipe(gulp.dest('./'));
});
// del build
gulp.task('clean', function () {
return require('del')(BUILD_PATH);
});
// Build documentation
gulp.task('docs', function () {
return gulp.src(JS_LOCATIONS.concat(['README.md']), {base: '.'})
.pipe(plugins.doxx({
title: 'HashDo Framework',
urlPrefix: ''
}))
.pipe(gulp.dest(BUILD_PATH + 'docs'));
});
// Run unit tests
gulp.task('test', function () {
return gulp.src('tests/**/*.js', {read: false})
.pipe(plugins.mocha({reporter: 'spec'}))
.once('error', function () {
process.exit(1);
})
.once('end', function () {
process.exit();
});;
});
gulp.task('watch', function () {
gulp.watch(['styles/less/*.less'], gulp.series('less'));
gulp.watch(JS_LOCATIONS, gulp.series('jshint', 'test'));
});
gulp.task('default', gulp.series('watch'));