dnafactory/module-scss
最新稳定版本:1.1.2
Composer 安装命令:
composer require dnafactory/module-scss
包简介
Provides an scss preprocessor to Magento 2
README 文档
README
Provides an Scss preprocessor (scssphp/scssphp) to Magento 2 as an Alternative Source Content Processor.
Supports Magento 2 Theme inheritance and Assets fallback system.
Frontend compilation is currently not tested and not fully implemented yet.
How to use
Put your base scss file in your preferred location as Magento 2 standards. Ex:
- app/design/frontend/MyCompany/theme/web/css/--->mystyle.scss
- app/code/MyCompany/MyModule/view/frontend/web/css/--->mystyle.scss
- app/design/frontend/MyCompany/theme/TheirCompany_TheirModule/web/css/--->mystyle.scss
Then add your source files references as you do with .less ones. Oh, and you can use Magento custom directives (like @magento_import) too. Ex:
@import 'source/_mixins'; @import 'source/functions.scss'; //@magento_import 'source/_extends.scss';
The @vars_import directive
As Magento 2 comes only with .less preprocessor, you may need to merge your new shiny scss project into the old fashioned .less theme. When it comes to needs, you can simply use the @vars_import directive on top of your main scss file to load and translate .less vars. Ex:
//@vars_import 'source/_variables.less'; @import 'source/_mixins'; @import 'source/functions.scss'; //@magento_import 'source/_extends.scss';
All less variables will be translated into scss readable ones, so you can then reference them in your scss subsequent assets.
Ex: @primary__color will be accessible as $primary__color
When you are coding in a module context you may need to import Magento 2 .less lib vars. Therefore, to avoid context issues, it may come in handy to use the @vars_import directive with the addition of the (lib) identifier. Ex:
//@vars_import (lib) 'source/lib/_lib.less'
Happy Coding
统计信息
- 总下载量: 2.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-11-30