2013-12-16 61 views
0

我剛剛安裝了Foundation 5和Sass,並且使用Compass觀看我的樣式表。我想知道添加自定義樣式的最佳做法是什麼。我已經創建了一個custom.scss文件,並使用@import「custom」引用它;在我的app.scss文件中。使用Mixins和Foundation 5

如果我想繼續改變身體的背景顏色,例如,我將如何使用mixin來做這件事。我加入:

$ body-bg:red;

我的custom.scss文件,但身體的背景沒有改變。我應該只編輯_settings.scss文件,這似乎是錯誤的...

任何想法我做錯了什麼?提前致謝!

這裏是我的config.rb:

# Require any additional compass plugins here. 
add_import_path "bower_components/foundation/scss" 

# Set this to the root of your project when deployed: 
http_path = "/" 
css_dir = "stylesheets" 
sass_dir = "scss" 
images_dir = "images" 
javascripts_dir = "javascripts" 

# You can select your preferred output style here (can be overridden via the command line): 
# output_style = :expanded or :nested or :compact or :compressed 

# To enable relative paths to assets via compass helper functions. Uncomment: 
# relative_assets = true 

# To disable debugging comments that display the original location of your selectors. Uncomment: 
# line_comments = false 


# If you prefer the indented syntax, you might want to regenerate this 
# project again passing --syntax sass, or you can uncomment this: 
# preferred_syntax = :sass 
# and then run: 
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass 

回答

0

在你的情況也許會更好使用這些結構:

app.scss:

@import "custom"; //where you define variables for foundation such as $body-bg: red; 
@import "foundation"; 
@import "other styles"; 
+0

這似乎也沒有工作。 – realph

+1

你可以發佈你的config.rb嗎? –

+0

我已將我的config.rb添加到上面的原始帖子中。 – realph

0

是的,我一直只是編輯_settings.scss文件 - 然後使用一個體面的文件比較(如Araxis合併或萬花筒合併新的選項,因爲更新)。如果我有自定義變量,我會把它們放在設置文件的頂部(在事實之後需要同時影響設置和我的全局內容)。