46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
const { parallel, src, dest } = require("gulp");
|
|
|
|
const sourcemaps = require("gulp-sourcemaps");
|
|
const concat = require("gulp-concat");
|
|
|
|
const gulp = require("gulp");
|
|
const uglify = require("gulp-uglify");
|
|
const babel = require("gulp-babel");
|
|
|
|
const sourceJs = "javascripts/**/*.js";
|
|
const sourceRemoteJS = [
|
|
"./node_modules/vue/dist/vue.global.prod.js",
|
|
"./node_modules/axios/dist/axios.min.js",
|
|
];
|
|
|
|
const destination = "public/js";
|
|
|
|
// TASKS ----------------------------------------------------------------------
|
|
|
|
const compileJs = function () {
|
|
return gulp
|
|
.src(sourceJs)
|
|
.pipe(sourcemaps.init())
|
|
.pipe(concat("main.js"))
|
|
.pipe(
|
|
babel({
|
|
presets: ["@babel/env"],
|
|
})
|
|
)
|
|
.pipe(uglify())
|
|
.pipe(sourcemaps.write("."))
|
|
.pipe(gulp.dest(destination));
|
|
};
|
|
const compileRemoteJs = function () {
|
|
return gulp
|
|
.src(sourceRemoteJS)
|
|
.pipe(sourcemaps.init())
|
|
.pipe(concat("libs.js"))
|
|
.pipe(sourcemaps.write("."))
|
|
.pipe(gulp.dest(destination));
|
|
};
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// COMMANDS -------------------------------------------------------------------
|
|
exports.default = parallel(compileJs, compileRemoteJs);
|
|
// ----------------------------------------------------------------------------
|