【问题标题】:Compass Error When Compiling Individual Stylesheets: "Individual stylesheets must be in the sass directory"编译单个样式表时出现指南针错误:“单个样式表必须在 sass 目录中”
【发布时间】:2016-02-10 15:48:19
【问题描述】:

我在使用 Compass 编译单个样式表时遇到问题。我可以使用compass compile 来处理所有文件,并使用compass watch 来监控更改。但是当我尝试将特定文件分配给 compass compile 时,我收到以下错误:

单独的样式表必须在 sass 目录中

我的目录结构:

project root
- util
-- compass
--- config.rb
- www
-- css
--- [destination for .css files]
-- sass
--- [.scss files]

我的 config.rb:

project_type = :stand_alone

# Set this to the root of your project when deployed:
project_path = "../../"
http_path = "www"               # The path to the project when running within the web server.
css_dir = "www/css"         # relative to project_path
sass_dir = "www/sass"       # relative to project_path
images_dir = "www/images"   # relative to project_path
javascripts_dir = "www/js"  # relative to project_path

# 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 = :compressed

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

# generate sourcemaps
sourcemap = true

/util/compass 文件夹运行时,以下工作正常:

compass compile
compass watch

这些不起作用:

compass compile builder.scss
compass compile ../../www/sass/builder.scss
compass compile www/sass/builder.scss

并导致错误,这可能意味着找不到scss文件。

我做错了什么?

【问题讨论】:

    标签: sass compass-sass compass


    【解决方案1】:

    这不是一个完美的解决方案,但至少可以帮助您前进。这可能是由指南针中的一些错误引起的,导致无效的sass_path。所以像这样手动设置sass_path

    project_type = :stand_alone
    
    # Set this to the root of your project when deployed:
    project_path = "../../"
    http_path = "www"               # The path to the project when running within the web server.
    css_dir = "www/css"         # relative to project_path
    sass_dir = "www/sass"       # relative to project_path
    sass_path = File.expand_path(File.join(project_path, sass_dir))
    images_dir = "www/images"   # relative to project_path
    javascripts_dir = "www/js"  # relative to project_path
    
    # 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 = :compressed
    
    # To enable relative paths to assets via compass helper functions. Uncomment:
    relative_assets = true
    
    # generate sourcemaps
    sourcemap = true
    

    然后您应该能够使用命令compass compile ../../www/sass/builder.scss 构建单独的 sass 文件

    【讨论】:

      猜你喜欢
      • 2013-10-25
      • 2015-02-08
      • 2014-11-22
      • 2014-05-05
      • 2014-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-15
      相关资源
      最近更新 更多