nizsheanez/yii2-asset-converter
Composer 安装命令:
composer require nizsheanez/yii2-asset-converter
包简介
Less, Sass, Scss and Phamlp converter for Yii2. No system requires. yii2-composer support, Less autoupdate, customizing of output directory
README 文档
README
Only for YII2 with the new Asset Manager, convert Less and Sass files to CSS whithout external tools and executable. The sass and less files are converted with PHP libraries It replace the AssetConverter who use external tools. The Less and Sass file are converted with time source files dependency.
###Requirements
YII 2.0
###Usage
- Install with Composer
"require": { "nizsheanez/yii2-asset-converter": "1.*", }, php composer.phar update
- Modify assetManager in your configuration file {app}/protected/config/main.php
'assetManager' => [ 'bundles' => require(__DIR__ . '/assets.php'), 'converter'=> [ 'class'=>'nizsheanez\assetConverter\Converter', ] ],
- Create .gitignore in
- Enjoy!
- Files with extension .sass are converted to a .css file
- Files with extension .less are converted to a .css file
- Files with extension .scss are converted to a .css file
###Example of assets config file /protected/config/assets.php
return [ 'app' => [ 'basePath' => '@webroot', 'baseUrl' => '@web', 'css' => [ 'css/bootstrap.min.css', 'css/bootstrap-responsive.min.css', 'css/site.css', 'css/less_style.less', 'css/sass_style.sass', ], 'js' => [ ], 'depends' => [ 'yii', ], ], ];
###Where is compiled files?
By default it present at @webroot/compiled But you can change it by destinationDir property from config
Full configuration
'components' => [ 'assetManager' => [ 'converter'=> [ 'class'=> 'nizsheanez\assetConverter\Converter', 'force'=> false, // true : If you want convert your sass each time without time dependency 'destinationDir' => 'compiled', //at which folder of @webroot put compiled files 'parsers' => [ 'sass' => [ // file extension to parse 'class' => 'nizsheanez\assetConverter\Sass', 'output' => 'css', // parsed output file type 'options' => [ 'cachePath' => '@app/runtime/cache/sass-parser' // optional options ], ], 'scss' => [ // file extension to parse 'class' => 'nizsheanez\assetConverter\Sass', 'output' => 'css', // parsed output file type 'options' => [] // optional options ], 'less' => [ // file extension to parse 'class' => 'nizsheanez\assetConverter\Less', 'output' => 'css', // parsed output file type 'options' => [ 'importDirs' => [], // import paths, you may use path alias here ex. '@app/assets/common/less' 'auto' => true, // optional options ] ] ] ] ], ],
Also, for SCSS files you can use alternate configuration:
'components' => [ 'assetManager' => [ 'converter'=> [ // ... 'parsers' => [ // ... 'scss' => [ // file extension to parse 'class' => 'nizsheanez\assetConverter\Scss', 'output' => 'css', // parsed output file type 'options' => [ // optional options 'enableCompass' => true, // default is true 'importPaths' => [], // import paths, you may use path alias here, // e.g., `['@path/to/dir', '@path/to/dir1', ...]` 'lineComments' => false, // if true — compiler will place line numbers in your compiled output 'outputStyle' => 'nested', // May be `compressed`, `crunched`, `expanded` or `nested`, // see more at http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style ], ], ], ], ], // ...
nizsheanez/yii2-asset-converter 适用场景与选型建议
nizsheanez/yii2-asset-converter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 170.54k 次下载、GitHub Stars 达 61, 最近一次更新时间为 2013 年 09 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「asset」 「compass」 「sass」 「scss」 「less」 「converter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nizsheanez/yii2-asset-converter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nizsheanez/yii2-asset-converter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nizsheanez/yii2-asset-converter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A collection of Compass targets for Phing.
Sass (SCSS) and Compass support for the Yii framework
Asset for Bulma Free for YiiFramework v.3.0.
Integrates CompassElephant into Symfony2
A library to manage a compass project with PHP
bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications.
统计信息
- 总下载量: 170.54k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 64
- 点击次数: 22
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2013-09-12