Answer the question
In order to leave comments, you need to log in
How to write a BEM build for Laravel Mix?
I have the following assembly on gulp:
var gulp = require('gulp'),
sass = require('gulp-sass'),
concatcss = require('gulp-concat'),
clean = require('gulp-clean'),
plumber = require('gulp-plumber'),
prefix = require('gulp-autoprefixer'),
concatjs = require('gulp-concat'),
browserSync = require('browser-sync').create();
gulp.task('blocks', function() {
return gulp.src('resources/assets/sass/blocks/**/*.scss')
.pipe(plumber())
.pipe(concatcss("_blocks.scss"))
.pipe(gulp.dest('resources/assets/sass/build/'))
.pipe(browserSync.stream());
});
gulp.task('sass', function() {
return gulp.src('resources/assets/sass/main.scss')
.pipe(plumber())
.pipe(sass().on('error', sass.logError))
.pipe(prefix({
browsers: ['last 10 versions'],
cascade: true
}))
.pipe(gulp.dest('public/css'))
.pipe(browserSync.stream());
});
gulp.task('clean', function () {
return gulp.src('resources/assets/sass/build/_blocks.scss', {read: false})
.pipe(clean())
.pipe(browserSync.stream());
});
gulp.task('watch', function() {
browserSync.init({
server: "./app"
});
gulp.watch('resources/assets/sass/blocks/**/*.scss', gulp.series('blocks', 'sass', 'clean'));
});
Answer the question
In order to leave comments, you need to log in
Do you need it? Laravel Mix is an add-on to webpack, and not the latest version of it. If you already have a gallp set up, then there is not much point in moving to a mix. Webpack is all about modules, and to reap the benefits, you need to break your code into modules, and not think about beams.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question