Class: Nanoc::Filters::Sass

Inherits:
Nanoc::Filter show all
Defined in:
lib/nanoc/filters/sass.rb

Constant Summary

Constant Summary

Constants inherited from Nanoc::Filter

Nanoc::Filter::TMP_BINARY_ITEMS_DIR

Instance Attribute Summary

Attributes inherited from Nanoc::Filter

#assigns

Instance Method Summary (collapse)

Methods inherited from Nanoc::Filter

#depend_on, #filename, from_binary?, #initialize, #output_filename, requires, setup, #setup_and_run, to_binary?, type

Methods included from PluginRegistry::PluginMethods

#all, #identifier, #identifiers, #named, #register

Methods inherited from Context

#get_binding, #initialize

Constructor Details

This class inherits a constructor from Nanoc::Filter

Instance Method Details

- (Object) imported_filename_to_item(filename)



22
23
24
25
26
27
# File 'lib/nanoc/filters/sass.rb', line 22

def imported_filename_to_item(filename)
  @items.find do |i|
    i.raw_filename &&
      Pathname.new(i.raw_filename).realpath == Pathname.new(filename).realpath
  end
end

- (String) run(content, params = {})

Runs the content through Sass. Parameters passed to this filter will be passed on to Sass.

Parameters:

  • content (String)

    The content to filter

Returns:

  • (String)

    The filtered content



13
14
15
16
17
18
19
20
# File 'lib/nanoc/filters/sass.rb', line 13

def run(content, params = {})
  options = params.merge({
    nanoc_current_filter: self,
    filename: @item && @item.raw_filename,
  })
  engine = ::Sass::Engine.new(content, options)
  engine.render
end