语法错误:要导入的文件未找到或不可读:基础/公共/比率

app*_*_UI 11 terminal sass zurb-foundation compass-sass

我安装了基础,当我编辑并保存app.scss文件时,它会在我项目的sass文件夹中创建一个"app.css"和一个"config.rb"文件.当我打开"app.css"文件时,我得到了这个

Syntax error: File to import not found or unreadable: foundation/common/ratios.
Run Code Online (Sandbox Code Playgroud)

然后根据我得到这个:

File to import not found or unreadable: foundation/common/ratios.
          Load paths:
            /Applications/MAMP/htdocs/WebApp02/sass
            /Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/blueprint/stylesheets
            /Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets
            Compass::SpriteImporter
    on line 1 of /Applications/MAMP/htdocs/WebApp02/sass/_settings.scss
    from line 2 of /Applications/MAMP/htdocs/WebApp02/sass/app.scss
Run Code Online (Sandbox Code Playgroud)

然后是我的宝石的一堆路径.

在我想知道是否有人可以解释为什么会发生这种情况之前,它从未在我的sass文件夹中创建app.css和config.rb文件.指南针仍然符合"样式表"文件夹中的app.css,但我想解决这个问题,以防止任何未来的错误发生.

config.rb文件看起来像这样

require 'zurb-foundation'
Require any additional compass plugins here.


Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
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
Run Code Online (Sandbox Code Playgroud)

小智 8

我在与sinatra的项目中遇到了同样的错误.它是从基础3.2.5升级到版本4.0.2之后.我意识到'基础/普通/比率'不再是zurb-foundation gem.我在"基础未找到或不可读"上又出现了另一个错误,因此在zurb-foundation之前我还需要修改需要'指南针'宝石的Gemfile

gem 'compass'
gem 'zurb-foundation'
Run Code Online (Sandbox Code Playgroud)

使用基础3.2.5"指南针"在Gemfile中没有明确要求,但现在它是,如果你看一下zurb-foundation.rb代码(在你的ruby gemset中),你可以看到:

if defined?(Compass)
  Compass::Frameworks.register("foundation",
    :stylesheets_directory => File.join(root,"scss"),
    :templates_directory => File.join(root,"templates")
  )
end
Run Code Online (Sandbox Code Playgroud)

因此,如果项目指南针未在zurb-foundation之前定义,则zurb-foundation.rb不会扩展包含scss文件夹的路径.

我希望我今天的经历可以帮到你.最好的问候,罗伯托

  • 由于'基础/普通/比率'不再出现在zurb-foundation gem中......我如何处理这个问题,我有同样的问题.我从Foundation和Overrides文件中删除了'foundation/common/ratios'import语句,但现在我的一些样式没有正确应用. (2认同)