-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
53 lines (48 loc) · 1.36 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
const { src, dest, series } = require('gulp');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
var sass = require('gulp-sass');
// sass.compiler = require('node-sass');
var through2 = require('through2');
var browserify = require('browserify');
var babelify = require('babelify');
function assets(cb) {
src('assets/**/*', {base:"./assets"})
.pipe(dest('./dist'));
src('data/**/*', {base:"."})
.pipe(dest('./dist'));
cb()
}
function styles(cb) {
return src('./lens.scss')
.pipe(sass().on('error', sass.logError))
.pipe(rename('lens.css'))
.pipe(dest('./dist'));
}
function buildjs(cb){
return src('./boot.js')
.pipe(through2.obj(function (file, enc, next) {
browserify({
entries: './boot.js',
debug: true,
transform: [babelify.configure({
presets: ['@babel/env']
})]
})
.bundle(function (err, res) {
if (err) {
return next(err);
}
file.contents = res;
next(null, file);
});
}))
.on('error', function (error) {
console.log(error, error.stack);
this.emit('end');
})
.pipe(rename('lens.js'))
.pipe(uglify())
.pipe(dest('./dist'));
}
exports.default = series(assets, styles, buildjs);