tystuyfzand / asset-combiner
PHP 的资源合并器
v1.1.0
2024-09-28 08:17 UTC
Requires
- assetic/framework: ^2.0
- illuminate/support: ~8.0|~9.0|~10.0|~11.0
Suggests
- matthiasmullie/minify: Minify Javascript output
- scssphp/scssphp: SCSS PHP Compiler
- wikimedia/less.php: Less PHP Compiler
README
OctoberCMS' Asset Combiner for Laravel,带有一些额外功能。
为什么
编译 LESS/SASS/JS 是一件痛苦的事情,尤其是在开发期间。在许多项目中,我发现 OctoberCMS 的这个功能简化了很多麻烦。
发生了什么变化
编译后的脚本/样式可以上传到存储中,允许使用 CDN 或本地存储。
计划支持其他形式的缓存和输出,以及许多其他功能。
安装
安装包
composer require tystuyfzand/assetcombiner
如果您打算使用 controller
选项生成文件,请注册路由
Route::get('/combine/{file}', 'AssetCombiner\Controllers\CombinerController');
发布配置
php artisan vendor:publish --provider="AssetCombiner\\AssetCombinerServiceProvider"
使用
在您的代码或模板中,您可以合并一系列文件
CombineAssets::combine([ 'assets/less/file.less' ], resource_path());
示例
<link rel="stylesheet" href="{{ CombineAssets::combine([ 'assets/less/file.less' ], resource_path()) }}">
许可
为了与 OctoberCMS 和从库中借用/分叉的代码保持兼容性,此库采用 MIT 许可证。