如何让nanoc SASS过滤器使用SCSS语法?

时间:2022-05-22 00:11:17

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

在我的nanoc网站中,我想使用SCSS指定我的样式:

p {
  em {
    color: red;
  }
}

... not SASS:

......不是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?

但是如果我尝试使用SCSS,我会从SASS过滤器中收到编译错误。如何使用SCSS?

1 个解决方案

#1


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:

nanoc中的过滤器似乎遵循采用任何选项的模式,并将它们传递给实际完成工作的任何对象。例如,Nanoc :: Filters :: Sass在其run方法中执行此操作:

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.

反过来,Sass :: Engine具有:语法作为可用选项。

#1


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:

nanoc中的过滤器似乎遵循采用任何选项的模式,并将它们传递给实际完成工作的任何对象。例如,Nanoc :: Filters :: Sass在其run方法中执行此操作:

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.

反过来,Sass :: Engine具有:语法作为可用选项。