开源软件名称(OpenSource Name):renatomarinho/laravel-page-speed开源软件地址(OpenSource Url):https://github.com/renatomarinho/laravel-page-speed开源编程语言(OpenSource Language):PHP 73.1%开源软件介绍(OpenSource Introduction):Laravel Page SpeedSimple package to minify HTML output on demand which results in a 35%+ optimization. Laravel Page Speed was created by Renato Marinho, and currently maintained by João Roberto P. Borges, Lucas Mesquita Borges and Renato Marinho. Installation
You can install the package via composer: composer require renatomarinho/laravel-page-speed This package supports Laravel Package Discovery. Publish configuration file
Do not forget to register middlewaresNext, the //app/Http/Kernel.php
protected $middleware = [
...
\RenatoMarinho\LaravelPageSpeed\Middleware\InlineCss::class,
\RenatoMarinho\LaravelPageSpeed\Middleware\ElideAttributes::class,
\RenatoMarinho\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
\RenatoMarinho\LaravelPageSpeed\Middleware\RemoveComments::class,
//\RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls::class,
//\RenatoMarinho\LaravelPageSpeed\Middleware\RemoveQuotes::class,
\RenatoMarinho\LaravelPageSpeed\Middleware\CollapseWhitespace::class, // Note: This middleware invokes "RemoveComments::class" before it runs.
\RenatoMarinho\LaravelPageSpeed\Middleware\DeferJavascript::class,
] Middlewares Details\RenatoMarinho\LaravelPageSpeed\Middleware\RemoveComments::classThe RemoveComments::class filter eliminates HTML, JS and CSS comments. The filter reduces the transfer size of HTML files by removing the comments. Depending on the HTML file, this filter can significantly reduce the number of bytes transmitted on the network. \RenatoMarinho\LaravelPageSpeed\Middleware\CollapseWhitespace::classThe CollapseWhitespace::class filter reduces bytes transmitted in an HTML file by removing unnecessary whitespace. This middleware invoke RemoveComments::class filter before executation.
BeforeAfter\RenatoMarinho\LaravelPageSpeed\Middleware\RemoveQuotes::classThe RemoveQuotes::class filter eliminates unnecessary quotation marks from HTML attributes. While required by the various HTML specifications, browsers permit their omission when the value of an attribute is composed of a certain subset of characters (alphanumerics and some punctuation characters). Quote removal produces a modest savings in byte count on most pages. \RenatoMarinho\LaravelPageSpeed\Middleware\ElideAttributes::classThe ElideAttributes::class filter reduces the transfer size of HTML files by removing attributes from tags when the specified value is equal to the default value for that attribute. This can save a modest number of bytes, and may make the document more compressible by canonicalizing the affected tags. \RenatoMarinho\LaravelPageSpeed\Middleware\InsertDNSPrefetch::classThe InsertDNSPrefetch::class filter Injects tags in the HEAD to enable the browser to do DNS prefetching. DNS resolution time varies from <1ms for locally cached results, to hundreds of milliseconds due to the cascading nature of DNS. This can contribute significantly towards total page load time. This filter reduces DNS lookup time by providing hints to the browser at the beginning of the HTML, which allows the browser to pre-resolve DNS for resources on the page.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论