gulch / assets
用于收集某些类型的资源(js、css)并将其一次性写入文档的包。
1.1.2
2021-01-31 16:13 UTC
Requires
- php: ^7.1 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^7.0 || ^8.0 || ^9.0
- satooshi/php-coveralls: ^2.0
- squizlabs/php_codesniffer: ^3.2
README
gulch/Assets
用于收集某些类型的资源(js、css)并将其一次性写入文档的PHP包。
特别感谢:Funtime 团队。
安装
您需要已安装Composer。
composer require gulch/assets
如何使用
use gulch\Assets\Asset; use gulch\Assets\Renderer\BodyCssRenderer; $bodyCss = new Asset(new BodyCssRenderer); $bodyCss->add('asset1.css')->add('asset2.css'); // ... $bodyCss->add('asset3.css'); // ... and in your html template just write $bodyCss->write();
结果
<link href="asset1.css" rel="stylesheet" type="text/css" property="stylesheet"> <link href="asset2.css" rel="stylesheet" type="text/css" property="stylesheet"> <link href="asset3.css" rel="stylesheet" type="text/css" property="stylesheet">