forked from Robdel12/DropKick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
99 lines (86 loc) · 2.61 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
96
97
98
99
/* global require */
var gulp = require('gulp-npm-run')(require('gulp'), {
exclude: ['test'],
require: ['doc']
}),
del = require('del'),
bump = require('gulp-bump'),
qunit = require('gulp-qunit'),
jshint = require('gulp-jshint'),
sass = require('gulp-sass'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
replace = require('gulp-replace'),
rename = require('gulp-rename'),
minimist = require('minimist'),
deploy = require('gulp-gh-pages-cname');
// Passing a version number
var knownOptions = {
string: 'ver'
};
var options = minimist(process.argv.slice(2), knownOptions);
gulp.task('default', ['sass', 'test', 'docs']);
gulp.task('docs', ['doc', 'docs-rename']);
gulp.task('build', ['sass', 'build-rename', 'build-polyfill', 'build-versionless-file']);
// Lint Task
gulp.task('lint', function() {
return gulp.src('./lib/dropkick.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Compile Our Sass
gulp.task('sass', function() {
return gulp.src('./lib/css/*.scss')
.pipe(sass())
.pipe(gulp.dest('build/css'));
});
gulp.task('bump', function(){
gulp.src('./*.json')
.pipe(bump())
.pipe(gulp.dest('./'));
});
// USEAGE: gulp build-rename --ver 2.x.x
gulp.task('build-rename', function() {
return gulp.src('./lib/dropkick.js')
.pipe(rename('dropkick.' + options.ver + '.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build/js/'));
});
gulp.task('build-polyfill', function() {
return gulp.src(['./lib/polyfills/*.js', './lib/dropkick.js'])
.pipe(concat('dropkick.' + options.ver + '.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build/js/'));
});
gulp.task('build-versionless-file', function() {
return gulp.src(['./lib/polyfills/*.js', './lib/dropkick.js'])
.pipe(concat('dropkick.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build/js/'));
});
gulp.task('deploy', function() {
return gulp.src('./docs/**/*').pipe(deploy({
cname: 'dropkickjs.com'
}));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('/lib/dropkick.js', ['docs']);
gulp.watch('css/*.scss', ['sass']);
});
gulp.task('docs-rename', function() {
setTimeout(function() { //ugh
return del(['./docs/index.html'], function () {
return gulp.src('./docs/classes/Dropkick.html')
.pipe(rename('index.html'))
.pipe(replace('../', ''))
.pipe(gulp.dest('./docs/'));
});
}, 4000);
});
gulp.task('test', function() {
//TODO: fix
// return gulp.src(['./tests/src/runner.html', './tests/src/iframe.html'])
return gulp.src(['./tests/src/runner.html'])
.pipe(qunit());
});