Answer the question
In order to leave comments, you need to log in
How to add js compilation modules to Laravel Mix?
I develop websites using gulp
const {src, dest} = require("gulp");
const gulp = require("gulp");
const autoprefixer = require("gulp-autoprefixer");
const cssbeautify = require("gulp-cssbeautify");
const cssnano = require("gulp-cssnano");
const imagemin = require("gulp-imagemin");
const plumber = require("gulp-plumber");
const rename = require("gulp-rename");
const rigger = require("gulp-rigger");
const sass = require("gulp-sass");
const uglify = require('gulp-uglify-es').default;
const concat = require("gulp-concat");
const removecomments = require("gulp-strip-css-comments");
function css() {
return src(path.src.css, { base: "src/assets/sass/" })
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer({
Browserslist: ['> 5% or last 8 versions']
}))
.pipe(cssbeautify())
.pipe(dest(path.build.css))
.pipe(cssnano({
discardComments: {
removeAll: true
}
}))
.pipe(removecomments())
.pipe(rename({
suffix: ".min",
extname: ".css"
}))
.pipe(dest(path.build.css))
.pipe(browsersync.stream());
}
function js() {
return src(path.src.js, {base: "./src/assets/js/"})
.pipe(plumber())
.pipe(rigger())
.pipe(uglify())
.pipe(concat('app.js'))
.pipe(rename({
suffix: ".min",
extname: ".js"
}))
.pipe(dest(path.build.js))
.pipe(browsersync.stream());
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question