jamesgordo / laravel-minify-html

一个最小化的Laravel包,用于压缩所有Laravel网络路由的HTML输出,适用于生产环境和预发布环境。

dev-master 2021-02-28 08:02 UTC

This package is auto-updated.

Last update: 2024-09-28 15:54:55 UTC


README

一个最小化的Laravel包,用于压缩所有Laravel网络路由的HTML输出,适用于生产环境和预发布环境。

使用方法

通过运行以下Composer命令安装此包。

composer require jamesgordo/laravel-minify-html

将包中间件添加到app/Http/Kernel.php文件中的$middlewareGroups['web']数组。

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,

            // ADD THIS LINE
            \JamesGordo\LaravelMinifyHtml\Http\Middleware\MinifyHtml::class,
        ],