-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
43 lines (38 loc) · 1.1 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
var browserify = require('browserify'),
gulp = require('gulp'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
runSequence = require('run-sequence');
// Transform code for browser support
gulp.task('browserify', function() {
// set up the browserify instance on a task basis
var b = browserify({
entries: './rdf2html.js'
});
return b.bundle()
.pipe(source('rdf2html.js'))
.pipe(buffer())
// Add transformation tasks to the pipeline here.
.pipe(uglify())
.on('error', gutil.log)
.pipe(gulp.dest('./dist/'));
});
// Copy required dist files from sub-modules
gulp.task('sub-dist', function() {
return gulp.src('node_modules/leaflet/dist/**')
.pipe(gulp.dest('./dist/'));
});
// Create a dist folder with all required public assets
gulp.task('dist', function(callback) {
runSequence(
'browserify',
'sub-dist',
function (error) {
if (error) {
console.log(error.message);
}
callback(error);
});
});