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


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

Syntax error: File to import not found or unreadable: foundation/common/ratios.

然后根据我得到这个:

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

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

在我想知道是否有人能解释为什么会发生这种情况之前,它从未在我的sass文件夹中创建app.css和config.rb文件。 Compass仍然符合“stylesheet”文件夹中的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

6561
2018-02-27 22:24


起源

你的config.rb是什么样的? - cimmanon
我将config.rb内容添加到原始问题中 - appsbar_UI


答案:


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

gem 'compass'
gem 'zurb-foundation'

有了基础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

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

我希望我今天的经历可以帮到你。 最好的祝福,    罗伯托


8
2018-03-01 14:45



非常感谢你! - appsbar_UI
由于'基础/普通/比率'不再在zurb-foundation gem中......我如何处理这个问题,我有同样的问题。我从Foundation和Overrides文件中删除了'foundation / common / ratios'import语句,但现在我的一些样式没有正确应用。 - General_9
如果在rails应用程序中出现此错误,请使用compass-rails - Will


我不能让这个工作(轨道3.2.12与资产管道和宝石“指南针轨道”和/或宝石“罗盘”)所以我只是锁定3.2.5

gem 'zurb-foundation', "= 3.2.5"

4
2018-03-13 17:19





当我尝试使用visual studio更新基础3网站时,我遇到了同样的错误 表现 2010. Express不允许使用Mindscape扩展工具。

所以现在这几次对我有用了。我基本上从使用指南针创建文件夹的新web文件夹开始。我不浪费时间尝试更新,因为这似乎对我有用。无论如何,在版本更新之前备份它是常见的。

从您网站上方的根文件夹。 (我使用vs默认路径)所以从rails中的命令行我cd到这个路径

> cd C:\Users\georgegargoyle\Documents\Visual Studio 2010\WebSites\

*请注意,如果你从基础3中取消选择,并且你只使用红宝石作为粉底,那么你很可能会拥有新基础所需的旧版本的sass。我不知道只是卸载并重新安装sass会受到伤害

是的

>  gem uninstall sass
> 
> gem install sass

我想如果它问你sass的版本,你不知道 键入第5个选项作为文本而不是数字5 ...所有版本? 然后..输入数字5 你可能得到两个警告,所以我只是打y或是两次。

无论如何,从网站文件夹类型

指南针创建你的新文件 - -r zurb-foundation - 使用基础

你应该看到很酷的Woot!那就是它

> cd yournewfolder

然后进入项目文件夹

gem install compass
gem update compass
gem install foundation
gem update foundation

基础的文档在下面,我是新手,所以这不一定是最佳实践,只是对我有用。感谢上面的gekorob,我想我学到了,我怀疑,由于你安装的版本,你运行这些命令的顺序很重要。红宝石,指南针,萨斯,基金会和视觉工作室。

我怀疑如果思考转换,可能会导致问题。并会引导你到这里来。

http://foundation.zurb.com/docs/sass.html

希望这会有所帮助,你会看到很多这样的事情。

http://www.ipaad.org/images/Step105.jpg


0
2017-07-19 23:35