-
Notifications
You must be signed in to change notification settings - Fork 29
/
gulpfile.js
51 lines (41 loc) · 1.07 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
'use strict';
var gulp = require('gulp'),
pkg = require('./package.json'),
paths = {
dest: './dist',
gulp: './gulpfile.js',
src: './index.js',
test: './test/*.{e2e,spec}.js'
};
gulp.task('default', ['build']);
gulp.task('lint', function () {
var eslint = require('gulp-eslint');
return gulp
.src([paths.gulp, paths.src, paths.test])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('cover', function () {
var istanbul = require('gulp-istanbul');
return gulp
.src(paths.src)
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['lint', 'cover'], function () {
var istanbul = require('gulp-istanbul'),
mocha = require('gulp-mocha');
return gulp
.src(paths.test)
.pipe(mocha({ reporter: 'spec' }))
.pipe(istanbul.writeReports());
});
gulp.task('build', ['test'], function () {
var browserify = require('browserify'),
source = require('vinyl-source-stream'),
options = { standalone: 'handlebars-layouts' };
return browserify(paths.src, options)
.bundle()
.pipe(source(pkg.name + '.js'))
.pipe(gulp.dest(paths.dest));
});