On a vanilla Laravel Spark install, it takes me about 20 seconds to run gulp. Here's my log:
[15:05:48] Starting 'all'...
[15:05:48] Starting 'less'...
[15:05:53] Finished 'less' after 4.74 s
[15:05:53] Starting 'webpack'...
[15:05:58]
[15:05:58] Finished 'webpack' after 5.28 s
[15:05:58] Starting 'copy'...
[15:05:59] Finished 'copy' after 486 ms
[15:05:59] Starting 'copy'...
[15:05:59] Finished 'copy' after 17 ms
[15:05:59] Starting 'less'...
[15:05:59] Finished 'less' after 159 ms
[15:05:59] Starting 'version'...
[15:05:59] Finished 'version' after 517 ms
[15:05:59] Finished 'all' after 11 s
[15:05:59] Starting 'default'...
My gulpfile:
var elixir = require('laravel-elixir');
var path = require('path');
require('laravel-elixir-vue-2');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
|
*/
elixir(function (mix) {
mix.less('app.less')
.webpack('app.js', null, null, {
resolve: {
modules: [
path.resolve(__dirname, 'vendor/laravel/spark/resources/assets/js'),
'node_modules'
]
}
})
.copy('node_modules/sweetalert/dist/sweetalert.min.js', 'public/js/sweetalert.min.js')
.copy('node_modules/sweetalert/dist/sweetalert.css', 'public/css/sweetalert.css');
mix.less('/brand/brand.less');
mix.version(['css/brand.css', 'css/app.css', 'js/app.js']);
I'm using the latest version of gulp and gulp CLI on a Mac Mini running valet. What can I do to make this run faster? 20 seconds seems excessive.
One thing you can try is to deactivate sourcemaps generation:
elixir.config.sourcemaps = false;
Second you can deactivate versioning in development mode, your app should work the same without any change:
if (elixir.config.production) {
mix.version(['css/brand.css', 'css/app.css', 'js/app.js']);
}