-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
61 lines (45 loc) · 1.4 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
58
59
60
61
const gulp = require('gulp'),
less = require('gulp-less'),
csso = require('gulp-csso')
const browserify = require("browserify");
const source = require('vinyl-source-stream');
const watchify = require("watchify");
const tsify = require("tsify");
const gutil = require("gulp-util");
const dist = "src/main/resources/toserve/";
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const buffer = require('vinyl-buffer');
const watchedBrowserify = watchify(browserify({
basedir: '.',
debug: true,
entries: ['frontend/ts/page-edit.ts'],
cache: {},
packageCache: {}
}).plugin(tsify)
.transform('babelify', {
presets: ['es2015'],
extensions: ['.ts', '.tsx', '.js']
})
);
function bundle() {
// process.env.NODE_ENV = 'production';
return watchedBrowserify
.bundle()
.pipe(source('page-edit.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
// .pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(dist + 'js/'));
}
gulp.task("js", bundle);
watchedBrowserify.on("update", bundle);
watchedBrowserify.on("log", gutil.log);
gulp.task('css', function() {
return gulp.src('frontend/less/*')
.pipe(less())
// .pipe(csso())
.pipe(gulp.dest('src/main/resources/toserve/css/'))
})
gulp.task('default', ['css'])