-
Notifications
You must be signed in to change notification settings - Fork 24
/
gulpfile.js
57 lines (52 loc) · 1.31 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
var gulp = require('gulp'),
path = require('path'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
jshintReporter = require('jshint-stylish'),
pkg = require(path.join(__dirname, 'package.json')),
plugins = require('gulp-load-plugins')({
config: path.join(__dirname, 'package.json')
});
var config = {
src: {
files: 'src/**/*.js'
}
};
var header = [
'/**',
' * <%= pkg.name %>',
' * <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
].join('\n');
gulp.task('jshint', function(done) {
gulp.src(config.src.files)
.pipe(plugins.jshint('.jshintrc'))
.pipe(plugins.jshint.reporter(jshintReporter));
done();
});
gulp.task('build', function() {
return browserify({
entries: 'filters.js',
detectGlobals: false,
basedir: './src/',
debug: false,
bundleExternal: true,
})
.bundle()
.pipe(source('angular-br-filters.js'))
.pipe(buffer())
.pipe(plugins.header(header, {pkg: pkg}))
.pipe(gulp.dest('./release/'))
.pipe(plugins.uglify())
.pipe(plugins.rename({
extname: '.min.js'
}))
.pipe(gulp.dest('./release/'));
});
gulp.task('default', ['jshint', 'build'], function() {
gulp.watch(config.src.files, ['jshint', 'build']);
});