forked from braintree/card-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (44 loc) · 1.16 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
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var size = require('gulp-size');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var watch = require('gulp-watch');
var eslint = require('gulp-eslint');
var del = require('del');
var config = {
namespace: 'braintree',
src: {
js: {
all: './src/**/*.js',
main: './index.js',
output: 'card-validator.js',
min: 'card-validator.min.js'
}
},
dist: 'dist'
};
gulp.task('lint', function () {
gulp.src([config.src.js.all])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('js', ['lint'], function () {
return browserify({standalone: 'cardValidator'})
.add(config.src.js.main)
.bundle()
.pipe(source(config.src.js.output))
.pipe(streamify(size()))
.pipe(gulp.dest(config.dist))
.pipe(streamify(uglify()))
.pipe(streamify(size()))
.pipe(rename(config.src.js.min))
.pipe(gulp.dest(config.dist));
});
gulp.task('clean', function (done) {
del([ config.dist ], done);
});
gulp.task('build', ['clean', 'js']);