-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
55 lines (43 loc) · 1.18 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
/*
* gulp-linker
* https://github.com/filipsobczak/gulp-linker
*/
'use strict';
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
nodeunit = require('gulp-nodeunit'),
linker = require('./'),
clean = require('gulp-clean');
var paths = {
scripts: ['*.js', 'test/*.js'],
tests: 'test/*_test.js',
testResultsDir: 'test/actual/',
linkedFile: 'test/fixtures/file.html',
linkedJS: 'test/fixtures/*.js'
};
gulp.task('jshint', function() {
// Minify and copy all JavaScript (except vendor scripts)
return gulp.src(paths.scripts)
.pipe(jshint());
});
gulp.task('linker', function() {
return gulp.src(paths.linkedFile)
.pipe(linker({
scripts: paths.linkedJS,
startTag: '<!--SCRIPTS-->',
endTag: '<!--SCRIPTS END-->',
fileTmpl: '<script src="%s"></script>',
appRoot: 'test/'
}))
.pipe(gulp.dest(paths.testResultsDir));
});
gulp.task('clean', function() {
return gulp.src(paths.testResultsDir, {read: false })
.pipe(clean());
});
gulp.task('nodeunit', [ 'linker' ], function() {
return gulp.src(paths.tests)
.pipe(nodeunit());
});
gulp.task('test', ['clean', 'nodeunit']);
gulp.task('default', ['jshint', 'test']);