2016-09-01 19 views
1

我對Ionic相當陌生,我正在使用離子2測試版使用角度2。離子在您的應用程序app/theme/app.variables.css中生成其默認樣式,其中primarysecondary等顏色被定義。他們給你的默認SCSS文件看起來是這樣的:Ionic - SCSS - '[scss])預計'&&'[scss] {預計'錯誤消息

// http://ionicframework.com/docs/v2/theming/ 

// Ionic Shared Functions 
// -------------------------------------------------- 
// Makes Ionic Sass functions available to your App 

@import "globals.core"; 

// App Shared Variables 
// -------------------------------------------------- 
// To customize the look and feel of this app, you can override 
// the Sass variables found in Ionic's source scss files. Setting 
// variables before Ionic's Sass will use these variables rather than 
// Ionic's default Sass variable values. App Shared Sass imports belong 
// in the app.core.scss file and not this file. Sass variables specific 
// to the mode belong in either the app.ios.scss or app.md.scss files. 


// App Shared Color Variables 
// -------------------------------------------------- 
// It's highly recommended to change the default colors 
// to match your app's branding. Ionic uses a Sass map of 
// colors so you can add, rename and remove colors as needed. 
// The "primary" color is the only required color in the map. 
// Both iOS and MD colors can be further customized if colors 
// are different per mode. 

$colors: (
    primary: #387ef5, 
    secondary: #32db64, 
    danger:  #f53d3d, 
    light:  #f4f4f4, 
    dark:  #222, 
    favorite: #69BB7B 
); 

而且,在他們的文檔提供,這是正確的密碼。 (儘管它們不包括favorite)。

My CodeDocs

順便說一句暗年底額外的逗號不會改變任何東西

現在的問題是,我得到2個錯誤。 1在primary: #387ef5,在冒號。話說在secondary: #32db64,冒號[scss]) expected.

primary error message

1說[scss] { expected. enter image description here

+0

它是完整的錯誤消息 – Ivaro18

+0

有沒有在瀏覽器中顯示但這是編輯器中的一個。也改變我的HTML有1個指令像危險和改變這個顏色變量不會改變任何東西 – Ivaro18

+0

當我刪除主要和次要它仍然會給出相同的錯誤信息,但在接下來的兩行 – Ivaro18

回答

0

簡單的做到這些:

$colors: (
    'primary': #387ef5, 
    'secondary': #32db64, 
    'danger':  #f53d3d, 
    'light':  #f4f4f4, 
    'dark':  #222, 
    'favorite': #69BB7B 
); 
+0

仍然收到相同的錯誤,現在二級現在是整個下劃線而不是僅僅冒號。 – Ivaro18

+0

其工作正常:O,您使用哪個版本的sass?此功能從3.3+開始可用 – Bamieh

+0

我沒有sass經驗,只是通過離子生成此項目,所以我不會真正知道在哪裏尋找。但是我發現了一個顯示一些版本號的package.json文件。它說'gulp-sass @^2.2.0'所以我猜2.2? – Ivaro18