【问题标题】:Bundler configuration to compile sass files用于编译 sass 文件的 Bundler 配置
【发布时间】:2013-09-23 18:33:31
【问题描述】:

罗盘正确监视我的目录时出现错误,但无法生成输出。我认为这与我的 GEMFILEcompass.rb 配置文件有关。

    ERROR: Guard::Compass failed to achieve its <run_on_change>, exception was:
Compass::Error: Nothing to compile. If you're trying to start a new project, you have left off the directory argument.

保护文件

# More info at 
# https://github.com/guard/guard#readme
# https://github.com/guard/guard/wiki/Guardfile-examples

# Launch Guard like this: [bundle exec] guard -g ui

group :ui do

#  guard :bundler, 
#    :hide_success => true do
#    watch('Gemfile')
#  end

  guard 'compass',
    :output => 'client/css',
    :workdir => 'source/sass',
    :configuration_file => 'config/compass.rb',
    :hide_success => true do
    #watch('source/sass/(.*)\.scss')
    watch(/source\/sass\/(.*)\.s[ac]ss/)

  end

end

还有我的 compass.rb 文件

    require 'sass'
require 'compass'

# Require any additional compass plugins here.

# Get the directory that this configuration file exists in
dir_src = File.dirname(__FILE__)

# Set this to the root of your project when deployed:
http_path = "/"
project_path = File.join(dir_src, "../", "")

sass_dir = "source/sass"
sass_path = sass_dir

css_dir = "client/css"
#css_path  = File.join(dir_src, "client", "css")

#images_dir = "img"
#images_path  = File.join(dir_src, "../public", "img")

#javascripts_dir = "js"
#javascripts_path  = File.join(dir_src, "../public", "js")

#Environment
#environment = :development

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
output_style = :expanded

# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false

# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
#preferred_syntax = :sass

# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
debug_info = false

我的文件夹结构如下,我的顶级目录。

project/
  client/
     css
  source/
     sass/

不知道为什么 compass 无法编译?

编辑:

【问题讨论】:

    标签: sass compass-sass


    【解决方案1】:

    sass_path 应该是绝对路径。在您的配置中,它是相对的。

    尝试将其注释掉,您已经拥有sass_dir

    如果这没有帮助,请分享您的项目目录结构。

    【讨论】:

    • 更新并添加了我的文件夹结构,我注释掉了 sass_path 定义,但我仍然收到相同的错误。
    • 通过直接查看我的客户端路径来解决问题。
    • 我从提出一个关于流星和 sass 的单独问题中找到的答案。 stackoverflow.com/questions/15912907/meteor-js-scss-compass。您关于删除 sass_path 和使用相对路径的回答有所帮助。我会认为这是答案
    猜你喜欢
    • 2014-07-04
    • 1970-01-01
    • 2018-07-17
    • 2014-05-04
    • 2018-12-27
    • 1970-01-01
    • 2018-07-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多