forked from canalplus/r7extlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
53 lines (46 loc) · 1.26 KB
/
gulpfile.js
File metadata and controls
53 lines (46 loc) · 1.26 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
46
47
48
49
50
51
52
53
(function() {
'use strict';
var gulp = require('gulp');
var argv = require('yargs').argv;
var jshint = require('gulp-jshint');
var rimraf = require('gulp-rimraf');
var browserify = require('gulp-browserify');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var mochaPhantomJS = require('gulp-mocha-phantomjs');
gulp.task('clean', function() {
return gulp
.src(['tmp', 'dist/r7extlib.js'], { read: false })
.pipe(rimraf());
});
gulp.task('lint', function() {
return gulp
.src(['gulpfile.js', 'src/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('compress', function() {
gulp.src('tmp/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('browserify', function() {
return gulp
.src('src/index.js')
.pipe(browserify())
.pipe(rename('r7extlib.js'))
.pipe(gulp.dest('tmp/'));
});
gulp.task('test', function() {
return gulp
.src('specs/index.html')
.pipe(mochaPhantomJS({
mocha: {
grep: argv['test-grep'],
},
reporter: 'spec',
}));
});
gulp.task('default', ['clean', 'lint', 'browserify', 'compress']);
})();