定制 inpassor/yii-eassetmanager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

inpassor/yii-eassetmanager

Composer 安装命令:

composer require inpassor/yii-eassetmanager

包简介

Extended Asset Manager Compiles .less file(s) on-the-fly and publishes output .css file

README 文档

README

EAssetManager class file.

Extended Asset Manager Compiles .less file(s) on-the-fly and publishes output .css file

Author: Inpassor inpassor@yandex.com . Link: https://github.com/Inpassor/yii-EAssetManager . Version: 0.3 (2013.10.24) .

INSTALLATION

##Install with composer:

composer require inpassor/yii-eassetmanager

##Manual install:

  1. Copy EAssetManager.php to /protected/vendor/ directory
  2. Add or replace the assetManager component in /protected/config/main.php like that:
	'components'=>array(

		...

		'assetManager'=>array(
			'class'=>'EAssetManager',
			'lessCompile'=>true,
			'lessCompiledPath'=>'application.assets.css',
			'lessFormatter'=>'compressed',
			'lessForceCompile'=>false,
		),

		...

	),

See code of EAssetManager.php to read description of public properties.

  1. CHMOD 'lessCompiledPath' directory to 0777 in order to create new files there by EAssetManager.
  2. Optional: enable Yii caching. Otherwise, EAssetManager will create (or use existing) directory /protected/runtime/cache/ and store cache data there. You can override this path by setting public property 'cachePath'.

USAGE

Just publish .less file with assetManager like that:

$css = CHtml::asset(Yii::app()->basePath.'/vendors/bootstrap/less/bootstrap.less');

That's all :)

Also it might be useful to pre-compile .less files. For example, to make command which compiles .less files in background. In this case you can use "lessCompile" method:

Yii::app()->assetManager->lessCompile(Yii::app()->basePath.'/vendors/bootstrap/less/bootstrap.less');

Output .css file will be stored under 'lessCompiledPath' directory. And then add already compiled file in your application:

$css = CHtml::asset(Yii::app()->assetManager->lessCompiledPath.'/bootstrap.css');

统计信息

  • 总下载量: 36
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固