1

I’m trying to create my own website and I’m using Nanoc. I’m also writing my files in HAML and SASS.
When I’m writing into my SASS file, I always have the error

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

when I compile (nanoc compile).
My sass files are in /content/css and I would like they go in /output/css

The thing I don’t understand is that if I put spaces or if I put a tab, it doesn’t compile. The only thing which works is when I don’t put any spaces or tabs. It compiles but the CSS in output doesn’t work.
I looked here before : https://groups.google.com/forum/#!topic/nanoc/UI4VccZCDD4 but it doesn't correct my compilation error.

I let my style.sass file and my Rules file below.

What is causing this issue and how can I resolve it?

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

If I put no spaces before width and background, it compiles but doesn't work.

#!/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
rene
  • 41,474
  • 78
  • 114
  • 152
oxiqxor
  • 11
  • 1
  • What version of nanoc are you using? A bug related to this problem was fixed recently, so upgrading may help. – Denis Defreyne Oct 05 '13 at 12:06
  • I'm using Nanoc 3.6.4. I made an update of Nanoc using the command `gem update nanoc` Now, when I make the command `gem list`, I have 'nanoc (3.6.5, 3.6.4)' but the problem is unfortunately still here; it doesn't compile. I just completely uninstalled nanoc and reinstalled it but the problem is not solved. I don't know where the compilation problem comes from... – oxiqxor Oct 05 '13 at 12:31
  • Do you use Bundler? In that case, make sure you run `bundle up` and check that the Gemfile contains nanoc 3.6.5. – Denis Defreyne Oct 05 '13 at 12:49
  • This also seems to be a Haml issue to me, rather than Sass. Can you share the `crash.log` and your default layout? – Denis Defreyne Oct 05 '13 at 12:49
  • I'm not using Bundler. Should I? – oxiqxor Oct 05 '13 at 13:02
  • Here is my `crash.log` – oxiqxor Oct 05 '13 at 13:03
  • http://pastebin.com/JZXfQtLe – oxiqxor Oct 05 '13 at 13:06
  • Here is my `default.haml` – oxiqxor Oct 05 '13 at 13:07
  • http://pastebin.com/UnVd9UHD – oxiqxor Oct 05 '13 at 13:09
  • I tried to make another `default.haml`file with nothing in it. I have the same error. I also downloaded another nanoc project on a GitHub repo and it works. So the mistakes comes from my files but I can't see where... – oxiqxor Oct 05 '13 at 18:44
  • It seems like the :haml filter is run on stylesheets, which is not what you want (you want `:sass` instead). Can you share your Rules file? – Denis Defreyne Oct 06 '13 at 09:03
  • I put my Rules file at the beginning of the topic ;) – oxiqxor Oct 06 '13 at 10:21
  • Oops, didn’t see that. Your problem is probably that the CSS file is not matched by the first rule, but rather by the catch-all rule, and therefore it gets the Haml layout applied. What is the filename of the Sass file? If it’s content/css/something, then the first rule should match '/css/*' instead of '/content/css/*' (content is superfluous). – Denis Defreyne Oct 06 '13 at 16:57
  • Your solution was the good one, ddfreyne! :) I changed /css/* instead of /content/css/ and it works! Thank you so much again! – oxiqxor Oct 07 '13 at 18:17

1 Answers1

0

The CSS compilation rule has an error. It should say

compile '/css/*'

instead of

compile '/content/css/*'

Item identifiers do not start with /content.

Denis Defreyne
  • 2,213
  • 15
  • 18