Laravel Mix

I’ve used Laravel Mix for couple of projects and its been amazing how easily it can be molde as per requirement, for example when you use Laravel-Mix for single page app for wordpress theme or for huge application with couple of themes and with large application with different manifest files or single manifest file for all themes etc

https://laravel.com/docs/master/mix

 

First thing to decide when to use Gulp, Webpack (Laravel-Mix)?

it’s easy to decide to use gulp as task runner and Webpack for assets compiling as explained in detail in this article.

https://www.toptal.com/front-end/webpack-browserify-gulp-which-is-better

Code Splitting & Dynamic Component Loading

https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components
https://stackoverflow.com/questions/53013149/laravel-optimizing-mix-webpack

Passing argument

https://www.npmjs.com/package/yargs

Optimize Laravel Mix for 50 plus themes

https://stackoverflow.com/questions/58000550/laravel-mix-build-process-scalable-up-to-lots-of-50-themes

Laravel Mix Extension to merge

https://laravel-mix.com/extensions/merge-manifest

When you want to have multiple entry points

https://stackoverflow.com/questions/45046696/laravel-mix-multiple-entry-points-generates-one-manifest-js

Automatic Build Process for Application Setup with Laravel Valet, Gulp and Laravel Mix

Modules Used

var cmd = require('node-cmd');
var gulp = require('gulp');
const fs = require('fs');
var shell = require('shelljs');
var silentState = shell.config.silent;
shell.config.silent = true;
shell.config.async = false;
var tld;

/*
* Update domain for laravel valet
* */
function setModuleDomain(module_dir_name) {
    shell.cd(module_dir_name)
    tld = shell.exec('valet domain', '-n').stdout.replace("n", '');
    shell.sed('-i', 'VALET_DOMAIN', tld, '.env');
}

/*
* Admin Setup
* */
gulp.task('admin', async function() {
    // - Setp 1 - IM Core Application
    shell.exec('git clone git@gitlab.com:PROJECTPATH.git;');
    shell.cd('FOLDER NAME');
    shell.exec('composer install; php artisan migrate; npm install; valet link {FOLDER NAME Without tld}; valet link {FOLDER NAME Without tld}; valet links secure {FOLDER NAME Without tld};');
    shell.cd('..');
    shell.echo('App setup complete.');
    shell.echo('domains setup complete');
});

/*
* Setup Frontend or Other Application Modules
* */

/*
* Task Runner - Gulp
* */
gulp.task('default',  gulp.series('admin', 'otherTasks'), function(){
    shell.echo('Application Modules setup complete');
});