2013-10-04 39 views
1

我正嘗試創建自己的網站,並使用Nanoc。我也在HAML和SASS中寫我的文件。
當我寫了我的SASS文件,我總是有誤差每次非法與SASS嵌套

Haml::SyntaxError: Illegal nesting: nesting within plain text is illegal 

當我編譯(nanoc compile)。
我頂嘴文件是在/content/css,我想他們去/output/css

我不明白的事情是,如果我把空格或者如果我把一個標籤,它不編譯。唯一有效的是當我沒有放置任何空格或製表符時。它編譯但輸出中的CSS不起作用。
我在這裏看過這裏:https://groups.google.com/forum/#!topic/nanoc/UI4VccZCDD4但它不能糾正我的編譯錯誤。

我讓我的style.sass文件和我的Rules文件如下。

是什麼導致了這個問題,我該如何解決它?

div.title 
    width: 80% 
    background-color: #b7b8b2 

如果我把沒有空格widthbackground之前,它編譯但不工作。

#!/usr/bin/env ruby 

require 'compass' 
Compass.add_project_configuration 'config.rb' # when using Compass 0.10 

### Compile rules 
compile '/content/css/*' do 
    filter :sass, Compass.sass_engine_options # add the second parameter for Compass 
end 

compile '*' do 
    if item.binary? 
    # don’t filter binary items 
    else 
    filter :haml 
    layout 'default' 
    end 
end 

### Route rules 
route '/content/css/*' do 
    #'/style.css' 
    # item.identifier.chop + '.css' #so that the /content/stylesheet.sass item is compiled in sass 
    unless item.identifier.start_with?('/content/css/_') # for partials 
     item.identifier.gsub(/\/$/, '') + '.css' 
    end 
end 

route '*' do 
    if item.binary? 
    # Write item with identifier /foo/ to /foo.ext 
    item.identifier.chop + '.' + item[:extension] 
    else 
    # Write item with identifier /foo/ to /foo/index.html 
    item.identifier + 'index.html' 
    end 
end 

### Layout rules 
layout '*', :haml 
+0

你使用的是什麼版本的nanoc?最近修復了與此問題相關的錯誤,因此升級可能會有所幫助。 – ddfreyne

+0

我使用Nanoc 3.6.4。 我使用'gem update nanoc'命令更新了Nanoc現在,當我使用'gem list'命令時,我有'nanoc(3.6.5,3.6.4)',但不幸的是問題仍然存在;它不會編譯。 我只是完全卸載nanoc並重新安裝它,但問題沒有解決。我不知道彙編問題來自哪裏...... – oxiqxor

+0

你使用Bundler嗎?在這種情況下,確保你運行'bundle up'並檢查Gemfile中是否包含nanooc 3.6.5。 – ddfreyne

回答

0

CSS編譯規則有錯誤。這應該說的

compile '/css/*'

代替

compile '/content/css/*'

產品標識不符合/content啓動。