autobahn/frontend/gulpfile.mjs
2023-02-19 01:20:55 +01:00

52 lines
1.4 KiB
JavaScript

import gulp from 'gulp';
const {src, parallel, dest, watch} = gulp
import dartSass from 'sass';
import gulpSass from 'gulp-sass';
const sass = gulpSass(dartSass);
import concat from 'gulp-concat';
import minify from 'gulp-minify';
import rename from 'gulp-rename';
const BUILD_TARGET_DIR = "../public/assets/";
export const css = () => {
return src('./src/scss/global.scss')
.pipe(sass())
.pipe(dest(BUILD_TARGET_DIR + 'css/'));
};
export const js = () => {
return src(['./src/js/**/*.js'])
.pipe(concat('app.js'))
.pipe(minify())
.pipe(rename("app.js"))
.pipe(dest(BUILD_TARGET_DIR + 'js/'));
};
export const libs = () => {
return src([
'./node_modules/bootstrap/dist/js/bootstrap.bundle.js',
'./node_modules/jquery/dist/jquery.js',
'./node_modules/leaflet/dist/leaflet.js'
])
.pipe(concat('libs.js'))
.pipe(minify())
.pipe(rename("libs.js"))
.pipe(dest(BUILD_TARGET_DIR + 'js/'));
};
export const w = () => {
watch(["./src/scss/**/*.scss", './public/**/*.html'], css);
watch("./src/js/**/*.js", js);
};
export const images = () => {
return src([
'./node_modules/leaflet/dist/images/*.png'
])
.pipe(dest(BUILD_TARGET_DIR + 'css/images/'))
}
export default parallel(css, js, libs);