lib/nanoc/filters/sass.rb
# Runs the content through [Sass](http://sass-lang.com/).
# Parameters passed to this filter will be passed on to Sass.
#
# @param [String] content The content to filter
#
# @return [String] The filtered content
Runs the content through [Sass].
Parameters passed to this filter will be passed on to Sass.
Runs the content through [ Sass ] . Parameters passed to this filter will be passed on to Sass .
def run(content, params={})
      options = params.dup
      sass_filename = options[:filename] ||
        (@item && @item[:content_filename])
      options[:filename] ||= sass_filename
      options[:filesystem_importer] ||=
        Nanoc::Filters::Sass::SassFilesystemImporter
      item_dirglob = Pathname.new(sass_filename).dirname.realpath.to_s + '**'
      clean_items = @items.reject { |i| i[:content_filename].nil? }
      @scoped_items, @rest_items = clean_items.partition do |i|
        i[:content_filename] &&
          Pathname.new(i[:content_filename]).realpath.fnmatch(item_dirglob)
      end
      engine = ::Sass::Engine.new(content, options)
      self.class.current = self
      engine.render
    end
def run ( content , params = { } ) options = params . dup sass_filename = options [ :filename ] || ( @item && @item [ :content_filename ] ) options [ :filename ] ||= sass_filename options [ :filesystem_importer ] ||= Nanoc :: Filters :: Sass :: SassFilesystemImporter item_dirglob = Pathname . new ( sass_filename ) . dirname . realpath . to_s + '**' clean_items = @items . reject { | i | i [ :content_filename ] . nil? } @scoped_items , @rest_items = clean_items . partition do | i | i [ :content_filename ] && Pathname . new ( i [ :content_filename ] ) . realpath . fnmatch ( item_dirglob ) end engine = :: Sass :: Engine . new ( content , options ) self . class . current = self engine . render end
Runs the content through [Sass](http://sass-lang.com/).
Runs the content through [ Sass ] ( http : // sass - lang . com / ) .
# Build options # Find items # Render
The filtered content
The filtered content
String
content
params
content The content to filter
content The content to filter