-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
93 lines (85 loc) · 2.44 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const autoprefixer = require('gulp-autoprefixer');
const browserify = require('browserify');
const buffer = require('vinyl-buffer');
const concat = require('gulp-concat');
const gulp = require('gulp');
const sass = require('gulp-sass');
const source = require('vinyl-source-stream');
const sourcemaps = require('gulp-sourcemaps');
const tsify = require('tsify');
let path = {
target: {
dest: 'resources',
},
sources: {
scripts: [
'assets/scripts/index.ts',
],
styles: [
'assets/styles/bootstrap.scss',
],
},
};
function appScripts() {
return browserify(path.sources.scripts)
.plugin(tsify)
.transform('babelify')
.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(`${path.target.dest}/scripts`));
}
function vendorStyles() {
return gulp
.src([
'node_modules/leaflet/dist/leaflet.css',
'node_modules/leaflet.awesome-markers/dist/leaflet.awesome-markers.css',
'node_modules/leaflet-control-geocoder/dist/Control.Geocoder.css',
'node_modules/leaflet-sidebar-v2/css/leaflet-sidebar.css',
])
.pipe(concat('vendor.css'))
.pipe(gulp.dest(`${path.target.dest}/styles`));
}
function appStyles() {
return gulp
.src(path.sources.styles)
.pipe(sass({
outputStyle: 'compressed',
}))
.pipe(autoprefixer())
.pipe(concat('app.css'))
.pipe(gulp.dest(`${path.target.dest}/styles`));
}
function vendorFonts() {
return gulp
.src([
'node_modules/@mdi/font/fonts/*'
])
.pipe(gulp.dest(`${path.target.dest}/fonts`));
}
function vendorImages() {
return gulp
.src([
'node_modules/leaflet/dist/images/*',
'node_modules/leaflet.awesome-markers/dist/images/*',
'node_modules/leaflet-control-geocoder/dist/images/*',
])
.pipe(gulp.dest(`${path.target.dest}/styles/images`));
}
gulp.task('watch', () => {
gulp.watch([
path.sources.scripts,
], {
usePolling: true
}, appScripts);
gulp.watch([
path.sources.styles,
], {
usePolling: true
}, appStyles);
});
gulp.task('default', gulp.series(appScripts, vendorStyles, appStyles, vendorFonts, vendorImages));