slexx/laravel-webp
Composer 安装命令:
composer require slexx/laravel-webp
包简介
Detect webp support in laravel framework
README 文档
README
Install
$ composer require slexx/laravel-webp
In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php file:
'providers' => [ // ... Slexx\LaravelWebp\LaravelWebpServiceProvider::class, ];
Add @webpJS directive to the <head> tag
<head> @webpJS <!-- ... --> </head>
Usage
Usage in blade
@webp <img src="/image.webp"/> @else <img src="/image.png"/> @endwebp
or in js, php
if (supportsWebp()) { // Does support! } else { // Does not support! }
or in css
html.webp { /* Does support! */ } html.no-webp { /* Does not support! */ }
统计信息
- 总下载量: 4.68k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-26