使用SASS自定义Foundation 5

时间:2014-04-16 16:34:37

标签: css sass zurb-foundation compass-sass

我在尝试设置Foundation 5时遇到了困难,因此我可以使用SASS对其进行自定义。根据Zurb基金会使用SASS是最简单的定制方式,但由于某些原因,没有任何有用的文件。

我到处搜索,找到了信息的点点和数量,最终设法得到了一些工作,这样当我修改主SCSS文件时,它会创建一个相应的CSS文件。但是,无论我添加到我的SCSS文件中的任何变量来尝试修改颜色等,它似乎没有任何效果。我在某处读取了要从_settings.scss文件中更改的变量,并将它们输入到您自己的scss文件中,然后修改这些值。任何人都可以帮我这个,它让我疯了。 我的文件夹/文件设置为:

/MyProject/
 /CSS/
    /foundation/
     - foundation.css
     - normalise.css
     - myfile.css
 /SCSS/
     /foundation/
            /components/ 
                 -- _accordion.scss
                 -- _etc.scss (and the rest ofthe files in components)
            -- _functions.scss
            -- _settings.scss
     - foundation.scss
     - normalise.scss
     - myfile.scss
  - index.html 

在myfile.scss中我有:

@import 'foundation.scss';
@import 'normalize.scss';


 $body-bg: #ccc;
 $body-font-color: #000;
// $body-font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
// $body-font-weight: normal;
// $body-font-style: normal;
无论我在上面的文件中做了什么更改,

myfile.css始终保持不变:

body {
  background: white;
  color: #222222;
  padding: 0;
  margin: 0;
  font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  position: relative;
  cursor: default; }

我收到的错误消息是:

DEPRECATION WARNING: The return value of index() will change from "false" to
"null" in future versions of Sass. For compatibility, avoid using "== false" on
the return value. For example, instead of "@if index(...) == false", just write
"@if not index(...)".
        on line  of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\foundation\_functions.scss, in `exports'
        from line 296 of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\foundation\components\_global.scss
        from line 5 of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\foundation\components\_accordion.scss
        from line 10 of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\foundation.scss
        from line 11 of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\store.scss
DEPRECATION WARNING on line 13 of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\foundation\_functions.scss:
Assigning to global variable "$modules" by default is deprecated.
In future versions of Sass, this will create a new local variable.
If you want to assign to the global variable, use "$modules: append($modules, $name) !global" instead.
Note that this will be incompatible with Sass 3.2.

DEPRECATION WARNING on line 18 of C:\Users\Leanne\Documents\work\freelance\sites\fws_templates\gamer\scss\foundation\components\_block-grid.scss:
Assigning to global variable "$block-grid-default-spacing" by default is deprecated.
In future versions of Sass, this will create a new local variable.
If you want to assign to the global variable, use "$block-grid-default-spacing: $column-gutter !global" instead.
Note that this will be incompatible with Sass 3.2.

Done.

1 个答案:

答案 0 :(得分:3)

您的变量需要先设置:

 $body-bg: #ccc;
 $body-font-color: #000;
// $body-font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
// $body-font-weight: normal;
// $body-font-style: normal;

@import 'foundation.scss';
@import 'normalize.scss';

弃用警告无需担心,因为它与您的问题无关(它们应该由基金会维护人员修复)。