quanzo / yii2-resource-collector
连接为Yii 2定义的资源视图
Requires
- php: >=7.0
- quanzo/x51-frontend: *
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-09-29 05:29:34 UTC
README
-
该模块允许您为每个模板设置样式和脚本。为此,设置两个文件,文件名为模板名称,扩展名为css和/或js。在这些资源中不能使用相对链接。
-
每种类型的资源都合并到一个文件中。这些文件放在一个文件夹中,可供网络服务使用。并且这些资源连接到页面。
-
其他资源压缩到一个文件中是可用的。
-
Scss文件将被转换为css。需要自定义。
-
支持将资源标记为预加载(https://mdn.org.cn/ru/docs/Web/HTML/Preloading_content)。
--------------------------------------------------------------------------
-
模块允许为每个模板指定样式和脚本。为此,需要设置两个文件,文件名与模板名称相同,扩展名为css和/或js。在这些资源中不能使用相对链接。
-
每个类型的资源合并为一个文件。这些文件放置在文件夹中,可供网络服务使用。并且这些资源连接到页面。
-
其他资源压缩为一个文件是可用的。
-
Scss文件将被转换为css。需要配置。
-
支持将资源标记为预加载(https://mdn.org.cn/ru/docs/Web/HTML/Preloading_content)。
--------------------------------------------------------------------------
安装
-
复制到模块文件夹中,并连接autoload.php
-
或者使用composer:将“quanzo/yii2-resource-collector”添加到项目的require部分
"quanzo/yii2-resource-collector": "*"
或composer require "quanzo/yii2-resource-collector"
-
添加到配置
$config = [
'bootstrap' => [
'collector',
],
'modules' => [
'collector' => [
'class' => 'x51\yii2\modules\resourceCollector\Module',
'cacheDir' => 'cache', // sets the name of the folder for saving cached resources (optional)
'optimizeCss' => false, // merge styles files
'optimizeJs' => false, // merge script files
'preload' => [], // or function ():array list of files to preload
'exclude' => [
'*ckeditor*'
], // or function ():array list of mask for exclude from optimize
'scssImportPath' => [], // a list of directories in which files scss for @import will occur
'scssVar' => [], // variables for scss
'scssFunc' => [], // functions for scss
],
]
];
事件
否
方法
否