basteyy/scss-php-builder
Composer 安装命令:
composer require basteyy/scss-php-builder
包简介
A ready to go server side scss builder.
README 文档
README
A ready to go server side scss builder. Based on the last time of filechange of your scss files, the script uses awesome scssphp to build your css code.
More or less its just a wrapper for scssphp.
Install
Use composer to install the script:
composer require basteyy/scss-php-builder
Usage
<?php // Get composers autoloader require __DIR__ . '/vendor/autoload.php'; // Construct the class $scss = new \basteyy\ScssPhpBuilder\ScssPhpBuilder(); // Add the input folder $scss->addFolder(__DIR__.'/scss'); // Define the output file $scss->addOutputeFile(__DIR__ . '/css/style.css'); // Define the scss starting point $scss->addStartingFile(__DIR__ . '/scss/style.scss'); // Than compile the scss source $scss->compileToOutputfile();
More examples
Expand the compiled source
Instead of expand the compiled css, you should use SourceMaps. Anyway, for expand the compiled:
$scss->setOutputExpanded();
Use SourceMap
<?php // Get composers autoloader require __DIR__ . '/vendor/autoload.php'; // Construct the class $scss = new \basteyy\ScssPhpBuilder\ScssPhpBuilder(); // Add the input folder $scss->addFolder(__DIR__.'/scss'); // Define the output file $scss->addOutputeFile(__DIR__ . '/css/style.css'); // Define the scss starting point $scss->addStartingFile(__DIR__ . '/scss/style.scss'); // If you like, you can acticate sourcemap by setup the remote url $scss->setSourcemapFolderUrl('/css/'); // Than compile the scss source $scss->compileToOutputfile();
Keep in mind, that you can the option, which is passed to the __construct will overwrite/control the sourcemap settings (see __construct Options)
Force recompile
$scss->compileToOutputfile(true);
Compile to string
$scss->getCompiledCode();
Force recompile to string
$scss->getCompiledCode(true);
__construct Options
You can pass a few options to the __construct:
// Construct the class $scss = new \basteyy\ScssPhpBuilder\ScssPhpBuilder([ 'auto_create_folders' => true, 'auto_create_files' => true, 'write_source_map' => true ]);
auto_create_folders if true, will create all folders auto_create_files if true, will create all foles write_source_map if true, will create the source map
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 127
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-30