-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgulpfile.js
57 lines (49 loc) · 1.38 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
/*
* /!\ WARNING /!\
*
* This file is the internal gulp configuration file,
* it is _not_ an example of gulpfile.js you can use.
*
* The base gulpfile.js provided by baked.js is: gulp.js
* Examples of gulpfile.js can be found in examples
*
* /!\ WARNING /!\
*/
var path = require('path');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var gulp = require('gulp');
var watch = require('gulp-watch');
var uglify = require('gulp-uglify');
var mocha = require('gulp-mocha');
var config = {
libName: 'baked.js',
libMinName: 'baked.min.js',
buildDir: 'build'
};
// Builds the browser-oriented library of baked.js
// (to be used by generated sources to achieve dynamic generation)
gulp.task('build', function() {
return gulp.src('./src/browser.js')
.pipe(browserify({
options: {
alias: ['../fake:canvas']
}
}))
.pipe(concat(config.libName))
.pipe(gulp.dest(config.buildDir));
});
gulp.task('test', function () {
return gulp.src('./test/*.js')
.pipe(mocha({reporter: 'dot'}));
});
gulp.task('compress', ['build'], function() {
return gulp.src(path.join(config.buildDir, config.libName))
.pipe(uglify())
.pipe(concat(config.libMinName))
.pipe(gulp.dest(config.buildDir))
});
gulp.task('watch', ['compress'], function () {
gulp.watch('./src/**/*.js', ['compress']);
});
gulp.task('default', ['compress']);