定制 clawrock/magento2-sass-preprocessor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

clawrock/magento2-sass-preprocessor

Composer 安装命令:

composer require clawrock/magento2-sass-preprocessor

包简介

Module for Sass processing during static content deployment

README 文档

README

Packagist Packagist Build Status Coverage Status

Magento 2 - Sass Preprocessor module

Module for Sass processing during static content deployment with additional Gulp workflow to improve Magento 2 development speed. It compiles SCSS using scssphp and process standard @import instruction as well as @magento_import.

Installation

  1. Install module via composer composer require clawrock/magento2-sass-preprocessor
  2. Register module php bin/magento setup:upgrade
  3. Compile Sass theme using php bin/magento setup:static-content:deploy -f

Example theme

Works with

Preprocessor

  • Magento 2.2 - 2.3
  • PHP 7.0 - 7.2

Gulp

  • Node.js 10+

Gulp

  1. Install Node.js
  2. Install Gulp configuration php bin/magento dev:gulp:install
  3. Install Gulp and required dependencies npm install
  4. Define theme configuration php bin/magento dev:gulp:theme
  5. Symlink theme to pub/static folder gulp exec:[theme_key]
  6. Compile SCSS gulp scss:[theme_key]
  7. Watch for changes gulp watch:[theme_key]

It also supports LESS, instead of SCSS use less like gulp less:[theme_key]

Use additional flags to enable more watchers:

  • --phtml: reload when phtml file is changed
  • --js: reload when js file is changed

Configure theme

You can manually configure theme like in Gruntfile which is shipped with Magento or use php bin/magento dev:gulp:theme command which will configure it for you.

Reference: Grunt configuration file

Commands

Shortcut Full command
gulp build:scss:[theme] gulp exec:[theme] && gulp scss:[theme]
gulp dev:scss:[theme] gulp exec:[theme] && gulp scss:[theme] && gulp watch:[theme]

List of gulp commands:

  • gulp clean:[theme_key]
  • gulp deploy:[theme_key]
  • gulp exec:[theme_key]
  • gulp scss:[theme_key]
  • gulp less:[theme_key]
  • gulp watch:[theme_key]
  • gulp build:scss:[theme_key]
  • gulp build:less:[theme_key]
  • gulp dev:scss:[theme_key]
  • gulp dev:less:[theme_key]

BrowserSync

Pass --proxy http://magento.test argument to gulp watch:[theme_key] or gulp dev:scss[theme_key] where http://magento.test is Magento base url and BrowserSync will be enabled.

You can configure BrowserSync in dev/tools/gulp/config/browser-sync.json. Reference

Example usage

gulp dev:scss:my_theme --proxy http://m2.test --phtml

Troubleshooting

If you had previously installed Grunt, please make sure you have removed package-lock.json and node_modules folder. Then run npm install.

For development with enabled SSL please provide path to SSL key and certificate in BrowserSync configuration file.

clawrock/magento2-sass-preprocessor 适用场景与选型建议

clawrock/magento2-sass-preprocessor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.12k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2018 年 10 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 clawrock/magento2-sass-preprocessor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 clawrock/magento2-sass-preprocessor 我们能提供哪些服务?
定制开发 / 二次开发

基于 clawrock/magento2-sass-preprocessor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 12.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: OSL-3.0
  • 更新时间: 2018-10-02