Sha256: bf7978acdc2ea5f3b8844fbea7597996f91b502b4362a8043ccb77baa3d3f939

Contents?: true

Size: 816 Bytes

Versions: 6

Compression:

Stored size: 816 Bytes

Contents

module Nanoc::Filters
  # @api private
  class Sass < Nanoc::Filter
    requires 'sass', 'nanoc/filters/sass/sass_filesystem_importer'

    # 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
    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

    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nanoc-4.0.0 lib/nanoc/filters/sass.rb
nanoc-4.0.0rc3 lib/nanoc/filters/sass.rb
nanoc-4.0.0rc2 lib/nanoc/filters/sass.rb
nanoc-4.0.0rc1 lib/nanoc/filters/sass.rb
nanoc-4.0.0b4 lib/nanoc/filters/sass.rb
nanoc-4.0.0b3 lib/nanoc/filters/sass.rb