oriceon/minify
Composer 安装命令:
composer require oriceon/minify
包简介
A package for minifying styles and javascript for laravel 6+
README 文档
README
With this package you can minify your existing stylessheet and javascript files for laravel 6+. This process can be a little tough, this package simplies this process and automates it.
Installation
Begin by installing this package through Composer.
composer require oriceon/minify
Publish the config file:
php artisan vendor:publish --provider="Oriceon\Minify\MinifyServiceProvider" --force
Package will auto-discover and you can use this Facade anywhere in your application
Stylesheet
// app/views/hello.blade.php <html> <head> ... {!! Minify::stylesheet('/css/main.css') !!} // or by passing multiple files {!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css')) !!} // add custom attributes {!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css'), array('foo' => 'bar')) !!} // add full uri of the resource {!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css'))->withFullUrl() !!} {!! Minify::stylesheet(array('//fonts.googleapis.com/css?family=Roboto')) !!} // minify and combine all stylesheet files in given folder {!! Minify::stylesheetDir('/css/') !!} // add custom attributes to minify and combine all stylesheet files in given folder {!! Minify::stylesheetDir('/css/', array('foo' => 'bar', 'defer' => true)) !!} // minify and combine all stylesheet files in given folder with full uri {!! Minify::stylesheetDir('/css/')->withFullUrl() !!} </head> ... </html>
Javascript
// app/views/hello.blade.php <html> <body> ... </body> {!! Minify::javascript('/js/jquery.js') !!} // or by passing multiple files {!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js')) !!} // add custom attributes {!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js'), array('bar' => 'baz')) !!} // add full uri of the resource {!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js'))->withFullUrl() !!} {!! Minify::javascript(array('//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js')) !!} // minify and combine all javascript files in given folder {!! Minify::javascriptDir('/js/') !!} // add custom attributes to minify and combine all javascript files in given folder {!! Minify::javascriptDir('/js/', array('bar' => 'baz', 'async' => true)) !!} // minify and combine all javascript files in given folder with full uri {!! Minify::javascriptDir('/js/')->withFullUrl() !!} </html>
Credits to main author
Fwork package : DevFactoryCH/minify
oriceon/minify 适用场景与选型建议
oriceon/minify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 348 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 03 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「minify」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oriceon/minify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oriceon/minify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oriceon/minify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CSS/Javascript Minificator, Compressor and Concatenator for TYPO3 - highly configurable frontend asset optimization for CSS/JS merging, minification and compression with optional body parsing, async/defer loading, inline output, data-ignore exclusions, SRI integrity validation/calculation, external
Caching and compression for Twig assets (JavaScript and CSS).
CSS & JavaScript minifier for Silverstripe
A package for pack css and javascript files
Modification of rmrevin/yii-2-minify-view lib to allow minification of css & js in a load balanced environment
统计信息
- 总下载量: 348
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-16