基于libsass从sass编译css的Lektor插件
lektor-scss的Python项目详细描述
lektor的SCSS编译器
用于Lektor的SCSS编译器,从sass编译css。在
它实际上是如何工作的?在
- 它使用libsass
- 它查找
.scss
和.sass
文件(忽略以下划线开头的部件文件,例如'_测试文件.scss)并将其作为生成过程的一部分进行编译。 - 它只在需要时重建css(文件更改、导入的文件更改或配置更改)。在
- 启动开发服务器时,它会在后台监视文件的更改,并在需要时重新生成它们。在
安装
您可以使用Lektor的安装程序安装插件:
lektor plugins add lektor-scss
或者手动将插件添加到lektorproject文件的packages部分:
^{pr2}$使用
要启用插件,请在启动开发时传递scss
标志
服务器或运行生成时:
# build and compile css from scss lektor build -f scss # edit site with new generated css lektor server -f scss
Python3
强烈建议将此插件与python3版本的lektor一起使用。在
由于lektor可以用作python模块,因此可以使用以下命令强制执行(在安装lektor之后,例如使用pip3 install --user --upgrade lektor
):
# run a python3 lektor server with new generated css
python3 -m lektor server -f scss
配置
该插件具有以下设置,您可以根据需要进行调整:
parameter | default value | description |
---|---|---|
source_dir | assets/scss/ | the directory in which the plugin searchs for sass files (subdirectories are included) |
output_dir | assets/css/ | the directory the compiled css files get place at |
output_style | compressed | coding style of the compiled result. choose one of: 'nested', 'expanded', 'compact', 'compressed' |
source_comments | False | whether to add comments about source lines |
precision | 5 | precision for numbers |
可以在configs/scss.ini
找到一个具有默认配置的示例文件。对于配置文件中未指定的每个参数,插件都使用默认值。在
发展
要在正在运行的lektor安装中测试和/或开发此插件,只需将其放在packages/
文件夹中,然后查看Lektor Doku
- 项目
标签: