p2made / p2y2-things
一系列CSS和JS资源,封装为Yii 2 AssetBundles和/或Widgets。
Requires
- p2made/p2y2-base: ^5.0
This package is auto-updated.
Last update: 2024-09-11 10:19:20 UTC
README
¡¡ 注意 !!
经过一段时间的忙碌后,我回到了Yii2开发。我会在我重新开始工作的每一个项目上重新合并。使用Bootstrap的项目将恢复到Bootstrap 5.x的版本 5.0.0
。
为Yii2提供资源集合,包括资源、助手和Widgets。
版本5之所以这样命名,是因为我已经将P2Y2Things迁移到使用Bootstrap v5。
突出
P2Y2 Assets
一系列CSS和JS资源,封装为Yii2 AssetBundles。这些都是方便加载大量CSS和JS好东西的方法。也可以选择从官方CDN获取资源。
Bootstrap Social Asset Bundle & Helpers
来自P2Y2 Assets的Bootstrap Social资产,受@rmrevin的yii2-fontawesome的启发。
感谢@lipis为Bootstrap Social做出的贡献。
FlagIconCss Asset Bundle & Helpers
来自P2Y2 Assets的flag-icon-css资产,受@rmrevin的yii2-fontawesome的启发。
感谢@lipis为Bootstrap Social做出的贡献。
IsGd Helper
对is.gd的简单封装,作为Yii 2框架的助手。
Uuid Helpers
对ramsey/uuid的简单封装,作为Yii 2框架的助手。
感谢@ramsey为ramsey/uuid做出的贡献,它提供了这里的所有UUID魔法。
安装
安装P2Y2Things的首选方式是通过composer。根据您的composer安装,运行以下命令之一
composer require p2made/p2y2-things "dev-master"
或
php composer.phar require p2made/p2y2-things "dev-5.0.0-dev"
或者将以下内容添加到您的composer.json
文件的requires部分
"p2made/p2y2-things": "dev-5.0.0-dev"
& 在您下次运行composer update
时安装P2Y2Things。
然后...
如果您正在使用P2Y2Things,您可能想取消一些Yii 2资产,以避免通过双重加载产生冲突。使用以下方式修改common/config/main.php
'components' => [
...
'assetManager' => [
'bundles' => [
'yii\web\JqueryAsset' => [
'sourcePath' => null, 'js' => [],
],
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => null, 'css' => [],
],
'yii\bootstrap\BootstrapPluginAsset' => [
'sourcePath' => null, 'js' => [],
],
'yii\jui\JuiAsset' => [
'sourcePath' => null, 'css' => [], 'js' => [],
],
'\rmrevin\yii\fontawesome\AssetBundle' => [
'sourcePath' => null, 'css' => [],
],
],
],
...
],
P2Y2Things为您提供从官方CDN加载资源的选择。只需将以下内容放入common/config/params.php
...
'p2m' => [
'assets' => [
'useStatic' => true, // false or not set to use published assets
],
],
当一切设置妥当时,使用以下方式注册P2CoreAsset
...
p2m\assets\P2CoreAsset::register($this);
...& 您将得到
Jquery
(作为p2m\assets\JqueryAsset
),yii\web\YiiAsset
(作为p2m\assets\P2YiiAsset
),Bootstrap
(作为p2m\assets\BootstrapAsset
), &Font Awesome
(作为p2m\assets\FontAwesomeAsset
)
在一行内优雅地加载。