【问题标题】:Changing the active colors of the buttons in toolbar in sencha using SASS使用 SASS 更改 sencha 工具栏中按钮的活动颜色
【发布时间】:2013-01-25 01:52:46
【问题描述】:

我正在寻找更改我的按钮颜色和 sencha 工具栏中按钮的活动颜色。在学习了一些教程后,我得到了这个。

我的示例 sass 代码:

@mixin sencha-toolbar-ui('toolbarcolour', #333333,'glossy') {
      $toolbar-border-color: darken(#333333, 50%);
      $toolbar-button-color: darken(#0088CC, 10%);

      .x-toolbar-#{toolbarcolours} {
        @include background-gradient(#333333, 'glossy');

        .x-toolbar-title {
          @include color-by-background(#FFFFFF);
          @include bevel-by-background(#FFFFFF);
        }

        .x-button, .x-field-select .x-input-text, .x-field-select:before {
          @include toolbar-button(#0088CC, 'glossy');
        }
      }
    }

使用 Compass 编译代码时出现以下错误:

    error app.scss (Line 32: Invalid CSS after "...cha-toolbar-ui(": expected va
    riable (e.g. $foo), was "'toolbarcolour'...")
    Sass::SyntaxError on line ["32"] of D: Invalid CSS after "...cha-toolbar-ui(": e
    xpected variable (e.g. $foo), was "'toolbarcolour'..."
    Run with --trace to see the full backtrace.

【问题讨论】:

    标签: sencha-touch sass compass-sass


    【解决方案1】:

    mixin 的参数需要命名,它们不能只是值的集合。在这里,我为参数命名并给了它们一个默认值:

    @mixin sencha-toolbar-ui($class: toolbarcolour, $color: #333333, $style: glossy) {
        $toolbar-border-color: darken($color, 50%);
        $toolbar-button-color: darken(#0088CC, 10%);
    
        .x-toolbar-#{$class} {
            @include background-gradient($color, $style);
    
            .x-toolbar-title {
                @include color-by-background(#FFFFFF);
                @include bevel-by-background(#FFFFFF);
            }
    
            .x-button, .x-field-select .x-input-text, .x-field-select:before {
                @include toolbar-button(#0088CC, $style);
            }
        }
    }
    

    【讨论】:

    • 感谢您的回复 仍然收到相同的语法错误 C:\Ruby193\bin>compass compile D:\My\WebDesign\xampp\htdocs\sencha\menu-mode-fin al-build\resources \sass 错误 app.scss(第 32 行:“...cha-toolbar-ui(”后的无效 CSS:预期变量(例如 $foo),是“($ class toolba...”) Sass::SyntaxError on D 行 ["32"]: Invalid CSS after "...cha-toolbar-ui(": e expected variable (eg $foo), was "($ class toolba..." 运行 --trace 看看完整的回溯
    • 错误提示$class之间有一个空格,应该是一起没有空格的:$class。评论是否破坏了错误的格式,或者那里真的有空格?
    • 我删除了空格并尝试仍然收到错误 C:\Ruby193\bin>compass compile D:\My\WebDesign\xampp\htdocs\sencha\menu-mode-fin al-build\resources \sass 错误 app.scss (第 32 行:“...cha-toolbar-ui(”后的无效 CSS:预期变量(例如 $foo),是“($class toolbar...") Sass::SyntaxError on D 的第 ["32"] 行:"...cha-toolbar-ui(": 预期变量(例如 $foo)之后的无效 CSS,是 "($class toolbar..." 使用 --trace 运行以查看完整的回溯
    • 您还从变量声明中删除了冒号:$variableName: value
    猜你喜欢
    • 1970-01-01
    • 2017-11-07
    • 1970-01-01
    • 2015-06-30
    • 1970-01-01
    • 2016-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多