承接 max-dreamsoft/yii2-asset-converter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

max-dreamsoft/yii2-asset-converter

Composer 安装命令:

composer require max-dreamsoft/yii2-asset-converter

包简介

Less, Sass, and Scss 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

  1. Install with Composer
"require": {
    "dreamsoft/yii2-asset-converter": "1.*",
},

php composer.phar update
  1. Modify assetManager in your configuration file {app}/protected/config/main.php
    'assetManager' => [
        'bundles' => require(__DIR__ . '/assets.php'),
        'converter'=> [
            'class'=>'dreamsoft\assetConverter\Converter',
        ]
    ],
  1. Create .gitignore in
  2. 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'=> 'dreamsoft\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
            'destinationDirPerms' => 0755, // permissions to assign to destinationDir
            'recursiveRecompileCheck' => false, // check timestamps of all source siblings and children
            'parsers' => [
                'sass' => [ // file extension to parse
                    'class' => 'dreamsoft\assetConverter\Sass',
                    'output' => 'css', // parsed output file type
                    'options' => [
                        'cachePath' => '@app/runtime/cache/sass-parser' // optional options
                    ],
                ],
                'scss' => [ // file extension to parse
                    'class' => 'dreamsoft\assetConverter\Scss',
                    'output' => 'css', // parsed output file type
                    'options' => [] // optional options
                ],
                'less' => [ // file extension to parse
                    'class' => 'dreamsoft\assetConverter\Less',
                    'output' => 'css', // parsed output file type
                    'options' => [
                        'auto' => true, // optional options
                    ]
                ]
            ]
        ]
    ],
],

Also, for SCSS files you can use alternate configuration:

'components' => [
    'assetManager' => [
            'converter'=> [
                // ...
                'parsers' => [
                    // ...
                    'scss' => [ // file extension to parse
                        'class' => 'dreamsoft\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
                            'generateMap' => false, // if true — compiler will generate map **
                            'outputStyle' => 'nested', // May be `compressed`, `crunched`, `expanded` or `nested`,
                                // see more at http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style
                        ],
                    ],
                ],
            ],
        ],
    // ...

** possible values for generateMap are:

  • \Leafo\ScssPhp\Compiler::SOURCE_MAP_FILE
  • \Leafo\ScssPhp\Compiler::SOURCE_MAP_INLINE
  • all (bin) positive values are SOURCE_MAP_FILE
  • all (bin) negative values are SOURCE_MAP_NONE

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 43
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-02-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固