2013-02-09 76 views
0

我正在尋找更改我在sencha工具欄中的按鈕顏色和按鈕的活動顏色。以下一些教程後,我得到了這個。使用SASS更改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'); 
     } 
     } 
    } 

當使用指南針,我發現了以下錯誤編譯代碼:需要被命名爲東西

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. 

回答

0

參數的混入,他們不能只是一個價值的集合。在這裏,我命名的參數,並給予他們一個默認值:

@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); 
     } 
    } 
} 
+0

感謝您的答覆仍然得到同樣的語法錯誤C:\ Ruby193 \ BIN>羅盤編譯d:\我的\網站設計\ XAMPP \ htdocs中\ sencha \ menu-mode-fin al-build \ resources \ sass error app.scss(Line 32:Invalid CSS after「... cha-toolbar-ui(」:expected va riable(eg $ foo),was 「($ class toolba ...」) Sass :: SyntaxError on line [「32」] D:「... cha-toolbar-ui(」:e xpected變量(例如$ foo)之後無效的CSS,是「($ class toolba ...」 使用--trace運行以查看完整回溯 – 2013-02-09 14:00:25

+0

錯誤表明存在空間b在'$'和'class'之間,它應該全部沒有空格:'$ class'。評論是否打破了錯誤的格式或者是否真的存在空間? – cimmanon 2013-02-09 17:09:41

+0

我刪除了空間,並試着仍然收到錯誤C:\ Ruby193 \ bin>羅盤編譯D:\ My \ WebDesign \ xampp \ htdocs \ sencha \ menu-mode-fin al-build \ resources \ sass error app。 scss(第32行:「... cha-toolbar-ui(」:expected va riable(例如$ foo),「($ class toolbar ...」)後無效的CSS) Sass :: SyntaxError on line [ D「後無效CSS:」... cha-toolbar-ui(「:e xpected變量(例如$ foo),是」($ class toolbar ...「 使用--trace運行以查看完全回溯 – 2013-02-10 10:27:06