forked from blake-regalia/gnis-ld.org
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
52 lines (45 loc) · 1.11 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
const gulp = require('gulp'),
pug = require('gulp-pug'),
less = require('gulp-less')
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
tap = require('gulp-tap');
browserSync = require('browser-sync');
/**
* pug compiler
*/
gulp.task('pug', async function() {
return gulp.src('lib/**/*.pug')
.pipe(pug())
.pipe(gulp.dest('dist'));
})
/**
* less compiler
*/
gulp.task('less', function(){
return gulp.src('lib/**/*.less')
.pipe(less())
.pipe(gulp.dest('dist'))
.pipe(browserSync.reload({stream: true}))
});
/*
* browserify task
*/
gulp.task('browserify', function() {
return gulp.src('lib/js/*.js', {read:false})
// transform file objects with gulp-tap
.pipe(tap((h_file) => {
// browserify
h_file.contents = browserify({
entries: [h_file.path],
debug: true,
}).bundle();
}))
// transform streaming contents into buffer contents
.pipe(buffer())
// output
.pipe(gulp.dest('dist/js'));
});
// Called when 'gulp' is run
gulp.task('default',gulp.series('pug', 'less', 'browserify'));