gpt4 book ai didi

javascript - 我怎样才能加快 gulp 速度?

转载 作者:行者123 更新时间:2023-12-03 05:10:01 26 4
gpt4 key购买 nike

在普通的 Laravel Spark 安装中,我需要大约 20 秒才能运行 gulp。这是我的日志:

[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'...

我的 gulp 文件:

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']);

我正在运行 valet 的 Mac Mini 上使用最新版本的 gulp 和 gulp CLI。我该怎么做才能让它运行得更快? 20 秒似乎有点过长。

最佳答案

您可以尝试的一件事是停用源映射生成:

elixir.config.sourcemaps = false;

其次,您可以在开发模式下停用版本控制,您的应用程序应该可以正常工作,无需任何更改:

if (elixir.config.production) {
mix.version(['css/brand.css', 'css/app.css', 'js/app.js']);
}

关于javascript - 我怎样才能加快 gulp 速度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41860812/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com