12

In my nanoc site, I want to specify my styles using SCSS:

p {
  em {
    color: red;
  }
}

... not SASS:

p 
  em 
    color: red

But if I try using SCSS, I get a compile error from the SASS filter. How do I get it to use SCSS?

Nathan Long
  • 122,748
  • 97
  • 336
  • 451

1 Answers1

15

This turned out to be quite simple:

filter :sass, syntax: :scss

Filters in nanoc seem to follow the pattern of taking any options they're given and passing them along to whatever object actually does the work. For instance, Nanoc::Filters::Sass does this in its run method:

def run(content, params={})
  options = params.dup
  # supply default options, etc...
  engine = ::Sass::Engine.new(content, options)
  # ...
  engine.render
end

Sass::Engine, in turn, has :syntax as an available option.

Nathan Long
  • 122,748
  • 97
  • 336
  • 451
  • 3
    With Compass you can also whack all the options in a ```config.rb``` file: ```Compass.add_project_configuration('config.rb')``` then in the rules you instead just pass it the whole set: ```filter :sass, Compass.sass_engine_options``` – iono Dec 07 '12 at 20:26
  • Note: If you need this to work on Ruby 1.8.x, use the older hash syntax instead: `:syntax => :scss` (I hadn't noticed until yesterday that Ruby 1.9.2 introduced a new hash syntax) – Ed Brannin May 23 '13 at 14:31