forked from miguel-perez/smoothState.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
45 lines (38 loc) · 1.03 KB
/
Copy pathgulpfile.js
File metadata and controls
45 lines (38 loc) · 1.03 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
'use strict';
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')();
var scripts = [
'./src/**/*.js',
],
tests = [
'./tests/**/*.js'
],
allScripts = scripts.concat(tests);
/** Run all unit tests */
gulp.task('test', function() {
return gulp.src('./tests/index.html')
.pipe(plugins.qunit());
});
/** Lint JavaScript */
gulp.task('jshint', function () {
return gulp.src(allScripts)
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
.pipe(plugins.jshint.reporter('fail'));
});
/** Concatenate and minify JavaScript */
gulp.task('uglify', function () {
return gulp.src(scripts)
.pipe(plugins.concat('jquery.smoothState.min.js'))
.pipe(plugins.uglify({preserveComments: 'some'}))
.pipe(gulp.dest('./'))
.pipe(plugins.size({title: 'scripts'}));
});
/** Watch changes */
gulp.task('watch', function() {
gulp.watch(allScripts, ['jshint', 'test']);
});
/** Default task */
gulp.task('default', ['jshint', 'test'], function() {
gulp.start('uglify');
});