无法编译Magento 2主题

时间:2019-01-27 10:41:30

标签: magento less command-line-interface magento2

我正在尝试编译一个以Magento /空白为父的Magento主题,每次尝试都会出现以下错误

[fsvuphkpwz]:public_html$ php bin/magento setup:static-content:deploy en_AU

Deploy using quick strategy
frontend/Magento/blank/en_AU            2163/2163           ============================ 100% %  1 sec               
adminhtml/Magento/backend/en_AU         2104/2104           ============================ 100% %  1 sec               
frontend/Magento/blank/en_AU            2163/2163           ============================ 100% %  1 sec               
adminhtml/Magento/backend/en_AU         2104/2104           ============================ 100% %  1 sec               
frontend/Magento/luma/en_AU             2179/2179           ============================ 100% %  1 sec               
frontend/GladiatorFitness/Gladiator/en_AU 2069/2201           ==========================>- 94% %   5 secs
Compilation from source: /mnt/data/home/######/fsvuphkpwz/public_html/vendor/magento/theme-frontend-blank/web/css/styles-m.less
error evaluating function `darken` The first argument to darken must be a color index: 2570 in _typography.less in _resets.less in _reset.less


  [Magento\Framework\Exception\FileSystemException]                                                                                                                                                        
  Cannot read contents from file "/mnt/data/home/#####/fsvuphkpwz/public_html/pub/static/frontend/GladiatorFitness/Gladiator/en_AU/css/styles-l.css" Warning!file_get_contents(/mnt/da  
  ta/home/#####/fsvuphkpwz/public_html/pub/static/frontend/GladiatorFitness/Gladiator/en_AU/css/styles-l.css): failed to open stream: No such file or directory   

_theme.less中的所有内容如下所示

//  Color nesting
@page__background-color: "#fff";
@sidebar__background-color: @color-gray40;
@primary__color: @color-gray80;
@border-color__base: @color-gray76;

@link__color: @color-gray56;
@link__hover__color: @color-gray60;

//  Buttons
@button__color: @color-gray20;
@button__background: @color-gray80;
@button__border: 1px solid @border-color__base;

//  Primary button
@button-primary__background: "#f15429";
@button-primary__border: none;
@button-primary__color: @color-white;
@button-primary__hover__background: "#f15429";
@button-primary__hover__border: none;
@button-primary__hover__color: @color-white;

//  Navigation
@navigation-level0-item__color: @color-gray80;
@submenu-item__color: @color-gray80;

@navigation__background: @color-gray40;
@navigation-desktop-level0-item__color: @color-gray80;
@navigation-desktop-level0-item__hover__color: @color-gray34;
@navigation-desktop-level0-item__active__color: @navigation-desktop-level0-item__color;

//  Tabs
@tab-control__background-color: @page__background-color;

//  Forms
@form-element-input__background: @color-gray89;
@form-element-input-placeholder__color: @color-gray60;

//  Header icons
@header-icons-color: @color-gray89;
@header-icons-color-hover: @color-gray60;

1 个答案:

答案 0 :(得分:1)

来自编译的错误消息说

Compilation from source: 

public_html/vendor/magento/theme-frontend-blank/web/css/styles-m.less
error evaluating function `darken` 
The first argument to darken must be a color index: 
    2570 in _typography.less in _resets.less in _reset.less

所以听起来好像有库存的magento代码调用LessCSS变暗函数/子例程/等? (我不确定LessCSS术语是什么)。但是,参数存在问题–它不是有效的LessCSS颜色索引。

这是被称为变暗的示例。

vendor/magento/magento2-base/lib/web/css/source/lib/variables/_typography.less
80:@border-color__base: darken(@page__background-color, 18%);

这是调暗的调用,其第一个参数为@page__background-color

因此,您的系统中有一个要变暗的调用,它的第一个参数的值不是“有效的LessCSS颜色索引”。因此,您已更改了某些内容((使您变暗的调用已添加了您自己?将@page__background-color之类的变量的值更改为无效的颜色索引吗?无意中删除了某个变量?)-已这样做,因此您的系统尝试使用无效值调用darken

根据您发布的内容,我的第一个猜测就是这个

@page__background-color: "#fff";

需要是这个

@page__background-color: #ffffff;

但这只是一个初步的猜测。

希望有帮助,祝您好运。