使用Mixins和Foundation 5

时间:2013-12-16 04:17:47

标签: zurb-foundation mixins

我刚刚用Sass安装了Foundation 5,并且正在使用Compass来观看我的样式表。我想知道添加自定义样式的最佳做法是什么。我已经创建了一个custom.scss文件,并使用@import“custom”引用它;在我的app.scss文件中。

如果我想继续改变身体的背景颜色,例如,我将如何使用mixins进行此操作。我正在补充:

$ 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

2 个答案:

答案 0 :(得分:0)

在你的情况下,也许最好使用这些结构:

app.scss:

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

答案 1 :(得分:0)

是的,我一直只编辑_settings.scss文件 - 然后使用体面的文件比较(如Araxis Merge或Kaleidoscope在更新时合并新选项)。如果我有自定义变量,我会将它们放在设置文件的顶部(这需要同时影响设置和我的全局内容)。