【问题标题】:sass error compiling zurb foundation with !global variable flag使用 !global 变量标志编译 zurb 基础的 sass 错误
【发布时间】:2015-01-06 20:32:14
【问题描述】:

'rake --trace assets:precompile' 命令给出以下错误:

rake aborted!
Sass::SyntaxError: Invalid CSS after "...ules: $modules ": expected "}", was "!global;"
  (in app/assets/stylesheets/foundation_and_overrides.scss:13)
foundation-rails-5.5.0.0/vendor/assets/stylesheets/foundation/_functions.scss:13
foundation-rails-5.5.0.0/vendor/assets/stylesheets/foundation/components/_global.scss:5
foundation-rails-5.5.0.0/vendor/assets/stylesheets/foundation/components/_grid.scss:5
foundation-rails-5.5.0.0/vendor/assets/stylesheets/foundation.scss:9
app/assets/stylesheets/foundation_and_overrides.scss:1327

错误似乎来自'foundation-rails-5.5.0.0/vendor/assets/stylesheets/foundation/_functions.scss'的第 13 行

  8 // IMPORT ONCE
  9 // We use this to prevent styles from being loaded multiple times for compenents that rely o    n other components.
 10 $modules: () !default;
 11 @mixin exports($name) {
 12   // Import from global scope
 13   $modules: $modules !global;
 14   // Check if a module is already on the list
 15   $module_index: index($modules, $name);
 16   @if (($module_index == null) or ($module_index == false)) {
 17     $modules: append($modules, $name) !global;
 18     @content;
 19   }
 20 }

SASS 语法对我来说看起来不错,如果我没有对生成的 'app/assets/stylesheets/foundation_and_overrides.scss 进行任何编辑,则编译不会出错。' 如果我对那个文件,比如下面这样,就会出现编译错误。

--- a/app/assets/stylesheets/foundation_and_overrides.scss
+++ b/app/assets/stylesheets/foundation_and_overrides.scss
@@ -14,7 +14,7 @@ $base-font-size: 100% !default;
 // Since the typical default browser font-size is 16px, that makes the calculation for grid siz
 // If you want your base font-size to be a different size and not have it effect grid size too,
 // set the value of $em-base to $base-font-size ($em-base: $base-font-size;)
-$em-base: 16px !default;
+$em-base: 17px !default;

 // It strips the unit of measure and returns it
 @function strip-unit($num) {

环境是 Rails 4.0.8,foundation-rails 5.5.0.0

【问题讨论】:

  • 更新到 Rails 4.0.12 不会改变结果。

标签: ruby-on-rails-4 compiler-errors sass zurb-foundation


【解决方案1】:

foundation-rails gem 已将其 Sass 依赖项的下限设置为 >= 3.2.0,但使用的是 Sass 3.3 功能(!global 标志)。您需要为您的项目指定 3.3 的依赖项。

我还建议向 Foundation-rails 的维护者提交错误报告。

【讨论】:

  • 如何指定 Sass 依赖?我有 gem 'sass-rails', '~> 4.0.3',这还不够吗?谢谢。
  • 好的,我的 Gemfile 有 sass-rails,它需要 sass
猜你喜欢
  • 2017-04-16
  • 2014-05-04
  • 2013-02-26
  • 1970-01-01
  • 2015-04-07
  • 1970-01-01
  • 2015-07-19
  • 2014-10-24
相关资源
最近更新 更多