2015-10-14 26 views
0

我在使用Compass編譯單個樣式表時遇到問題。我可以使用compass compile來執行所有文件,並使用compass watch來監視更改。但是,當我嘗試將一個特定的文件分配到compass compile,我得到得到以下錯誤:編譯單個樣式表時出現羅盤錯誤:「單個樣式表必須位於sass目錄中」

Individual stylesheets must be in the sass directory

我的目錄結構:

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 

以下

compass compile 
compass watch 
01:從 /util/compass文件夾中運行時正常工作

這些不工作:

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

,並導致這大概意味着無法找到的SCSS文件中的錯誤。

我在做什麼錯?

回答

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