2

我用谷歌搜索并阅读网页,直到我的眼睛流血,但仍然找不到答案。所以,如果这个问题已经得到回答,请原谅。

我的指南针项目 grunt “编译”对于生产和开发“模式”来说很好。使用 chrome 时,源映射工作。但是,Chrome 报告所有指南针库/核心文件的 404 错误。

以下是 404:http: //i.stack.imgur.com/Kyqq6.jpg

我可以从源映射文件中看到问题出在哪里,但不知道如何解决。这是 style.css.map 文件:

{
"version": 3,
"mappings": "..snip-snip..",
"sources": ["../sass/_print.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/typography/_units.scss","../sass/components/_colors.scss","../sass/components/_fonts.scss","../sass/components/_header.scss","../sass/components/_misc.scss","../sass/_mixins.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/utilities/general/_clearfix.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/utilities/general/_hacks.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/css3/_images.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/typography/_vertical_rhythm.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/_support.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/css3/_text-shadow.scss","../sass/_init.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/css3/_transition.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/css3/_border-radius.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/css3/_appearance.scss","../sass/_normalize.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/css3/_box-sizing.scss","../sass/layouts/_fixed.scss","../sass-extensions/zen-grids/stylesheets/zen/_grids.scss","../sass/styles.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/css3/_box-shadow.scss","../../../../../../../../../usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/css3/_transform.scss"],
"names": [],
"file": "styles.css"
}

所以所有的“../../../..”在开发过程中都会导致 404 错误,这非常烦人。基本上罗盘生成的路径是无效的。

有谁知道如何让指南针表现得这样才不会发生?我认为它在我的 config.rb 中是必要的,但我不知道是哪一个: http ://compass-style.org/help/documentation/configuration-reference/

这是我的 config.rb:

#
# Change this to :production when ready to deploy the CSS to the live server.
#environment = :production
firesass = (environment == :development) ? true : false
css_dir         = "css"
sass_dir        = "sass"
add_import_path  "sass/components"
extensions_dir  = "sass-extensions"
images_dir      = "images"
javascripts_dir = "js"
output_style = (environment == :development) ? :expanded : :compressed
relative_assets = true
sass_options = (environment == :development && firesass == true) ? {:debug_info => true} : {}
#
# When true this will cause errors for trying to download files from $base_url/usr/local/rvm/gems/ruby-2.1.2/gems/compass-core-1.0.1/stylesheets/compass/_support.scss
# Errors go away when set to false (in production)
sourcemap = (environment == :development) ? true : false

网络上的大多数示例都提供了告诉 Chrome 您的本地实例在哪里的说明,但我的本地实例位于 vm 主机上,而不是共享文件系统的 Mamp 主机上 - 所以这些示例没有帮助。

并且要明确一点 - 源映射适用于非指南针核心文件。通过工作,我的意思是 - 不要抛出 404 并在开发人员检查器中指向正确的源代码行。

非常感谢您的帮助。

附言。我已经为 sass 和 compass 尝试了 gem 卸载/安装——这似乎没有帮助。

4

0 回答 0