-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
38 lines (35 loc) · 989 Bytes
/
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
var gulp = require('gulp');
gulp.task('peg', function() {
var peg = require('gulp-peg');
gulp.src('unedtfy.pegjs')
.pipe(peg())
.pipe(gulp.dest('tmp'));
});
gulp.task('build', ['peg'], function () {
var uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
sourcemaps = require('gulp-sourcemaps');
var b = browserify('./unedtfy.js', {
standalone: 'unedtfy',
plugin: [
[ "browserify-derequire" ]
]
});
return b.bundle()
.pipe(source('unedtfy.js'))
.pipe(buffer())
.pipe(gulp.dest('dist'))
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.pipe(rename({extname: '.min.js'}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('dist'));
});
gulp.task('test', function () {
var mocha = require('gulp-mocha');
return gulp.src('tests/common/*.js')
.pipe(mocha());
});