-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
63 lines (55 loc) · 1.67 KB
/
gulpfile.js
File metadata and controls
63 lines (55 loc) · 1.67 KB
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
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
jshint = require('gulp-jshint'),
wrap = require('gulp-wrap'),
defineModule = require('gulp-define-module'),
mocha = require('gulp-mocha'),
babel = require('gulp-babel');
var JS_PATH = 'lib/*.js';
var TEST_JS_PATH = 'test/*.js';
//Execute JSHINT on JS
gulp.task('lint', function() {
return gulp.src(JS_PATH)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Concatenate & Minify JS
gulp.task('production-script', function() {
return gulp.src(JS_PATH)
.pipe(babel())
.pipe(uglify())
.pipe(defineModule('plain'))
.pipe(rename('kbn.min.js'))
.pipe(gulp.dest('dist'));
});
//Concatenate JS
gulp.task('develop-script', function() {
return gulp.src(JS_PATH)
.pipe(babel())
.pipe(defineModule('plain'))
.pipe(gulp.dest('dist'));
});
//Testing task to use netuitive-api.js
gulp.task('develop-test', ['lint', 'develop-script'], function() {
return gulp.src([TEST_JS_PATH], { read: false })
.pipe(mocha({
reporter: 'spec'
}));
});
//Testing task to use netuitive-api.min.js
gulp.task('production-test', ['lint', 'production-script'], function() {
return gulp.src([TEST_JS_PATH], { read: false })
.pipe(mocha({
reporter: 'spec'
}));
});
//Local development task. Runs through concat, jshint
gulp.task('default', ['develop-test'], function() {
// place code for your default task here
gulp.watch(JS_PATH, ['lint', 'develop-script']);
gulp.watch(TEST_JS_PATH, ['develop-test']);
});
//Production build task. Runs through concat, jshint
gulp.task('production', ['production-test']);