0

刚刚安装了断点并尝试在现有的博客项目(html/css/js/php)上使用。目前使用 Sass 和 Susy 来处理基本的网格内容,但我想在这个项目上尝试一下 Breakpoint,因为我最近意识到它的易用性和灵活使用。

安装成功后,将以下内容添加到我的项目中:

require 'breakpoint'到 config.rb 文件

@import "breakpoint" sass 中的 _base 文件。

刷新后,浏览器中出现此错误消息:

Syntax error: File to import not found or unreadable: breakpoint.\A Load paths:\A /Users/pbj/Desktop/code/the-start/themes/thestart/sass\A /Library/Ruby/Gems/2.0.0/gems/compass-0.12.3/frameworks/blueprint/stylesheets\A /Library/Ruby/Gems/2.0.0/gems/compass-0.12.3/frameworks/compass/stylesheets\A /Library/Ruby/Gems/2.0.0/gems/susy-1.0.9/sass\A Compass::SpriteImporter\A on line 6 of /Users/pbj/Desktop/code/the-start/themes/thestart/sass/_base.scss\A from line 5 of /Users/pbj/Desktop/code/the-start/themes/thestart/sass/screen.scss\A \A 1: /Users/pbj/Desktop/code/the-start/themes/thestart/sass/screen.scss"

命令行中也出现此错误:

Errno::EACCES on line ["1143"] of /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb: Permission denied - /Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.0.alpha.17/stylesheets/.listen_test Run with --trace to see the full backtrace

在运行完整的回溯后,我在命令行中得到了这个:

Errno::EACCES on line ["1143"] of /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb: Permission denied - /Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.0.alpha.17/stylesheets/.listen_test /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1143:in open' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1143:inrescue in block in touch' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1139:in block in touch' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1137:ineach' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1137:in touch' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/adapter.rb:221:inworks?' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/adapter.rb:182:in block in usable_and_works?' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/adapter.rb:182:ineach' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/adapter.rb:182:in all?' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/adapter.rb:182:inusable_and_works?' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/adapter.rb:49:in block in select_and_initialize' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/adapter.rb:47:ineach' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/adapter.rb:47:in select_and_initialize' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/listener.rb:272:ininitialize_adapter' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/listener.rb:264:in setup' /Library/Ruby/Gems/2.0.0/gems/listen-1.1.6/lib/listen/listener.rb:64:instart!' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/lib/compass/watcher/project_watcher.rb:31:in watch!' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/lib/compass/commands/watch_project.rb:48:inperform' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/lib/compass/commands/base.rb:18:in execute' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/lib/compass/commands/project_base.rb:19:inexecute' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/lib/compass/exec/sub_command_ui.rb:43:in perform!' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/lib/compass/exec/sub_command_ui.rb:15:inrun!' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/bin/compass:30:in block in <top (required)>' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/bin/compass:44:incall' /Library/Ruby/Gems/2.0.0/gems/compass-1.0.0.alpha.18/bin/compass:44:in <top (required)>' /usr/bin/compass:23:inload' /usr/bin/compass:23:in `'

当我安装断点时,它也安装了:

  • sass-3.3.0.rc.6
  • 罗盘-1.0.0.alpha.18
  • 断点-2.4.1

当我检查当前版本的 sass 时,它是 sass-3.3.0.rc.6。

不确定到底发生了什么。我确实读过类似的问题,其中解决方案是调用compass watch config.rb 文件的父目录,或者类似的东西。仍然以同样的错误结束。

编辑:当注释掉断点以尝试在不使用(暂时)的情况下继续前进时,浏览器中会抛出此错误:

"Syntax error: Undefined variable: \"$experimental-support-for-mozilla\".\A on line 25 of /Library/Ruby/Gems/2.0.0/gems/susy-1.0.9/sass/susy/_support.scss\A from line 5 of /Library/Ruby/Gems/2.0.0/gems/susy-1.0.9/sass/_susy.scss\A from line 5 of /Users/pbj/Desktop/code/the-start/themes/thestart/sass/_base.scss\A from line 5 of /Users/pbj/Desktop/code/the-start/themes/thestart/sass/screen.scss"

而命令行中的这个错误: Errno::EACCES on line ["1143"] of /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb: Permission denied - /Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.0.alpha.17/stylesheets/.listen_test

认为这是因为它试图使用 v3.3?

有人对如何解决这个问题有一些建议吗?

当前运行 15" MBPr OSX v.10.9.2 (Mavericks)

4

2 回答 2

4

您的问题的答案是Bundler!Bundler 会将您的项目锁定到特定的 gem 中,并确保它们可供使用。如果您使用的是 Susy 1.x 并想使用断点,您的 Gemfile 应该如下所示:

source 'http://rubygems.org' gem 'sass', '~>3.2.0' gem 'compass', '~>0.12.0' gem 'susy', '~>1.0.0' gem 'breakpoint', '~>2.0.0'

但是,如果您想使用最新最好的,您的 Gemfile 应该如下所示:

source 'http://rubygems.org' gem 'sass', '~>3.3.0.rc.3' gem 'compass', '~>1.0.0.alpha.18' gem 'susy', '~>2.0.0.rc.2' gem 'breakpoint', '~>2.4.0'

请记住并通过( )bundle install运行 Compass 编译bundle execbundle exec compass watch

于 2014-03-06T12:34:00.090 回答
0

通过 npm 安装断点时我遇到了同样的问题,我通过npm install breakpoint-sass修复它,然后我将它导入到我的app.scss中,就像这样 @import '~/node_modules/breakpoint-sass/stylesheets/breakpoint';

将此代码用于响应式布局:

。班级名称 {

    **@include breakpoint(max-width 800px) {
     ...
    }**

}

于 2020-12-28T05:06:01.867 回答