Sha256: 845f73cfd35a10f3ace134b58629dff3cfe4defcdb1bb53500f9f3e8f3cbb9e6

Contents?: true

Size: 826 Bytes

Versions: 9

Compression:

Stored size: 826 Bytes

Contents

# encoding: utf-8

module Nanoc::Filters
  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

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-3.7.4 lib/nanoc/filters/sass.rb
nanoc-3.7.3 lib/nanoc/filters/sass.rb
nanoc-3.7.2 lib/nanoc/filters/sass.rb
nanoc-3.7.1 lib/nanoc/filters/sass.rb
nanoc-3.7.0 lib/nanoc/filters/sass.rb
nanoc-3.6.11 lib/nanoc/filters/sass.rb
nanoc-3.6.10 lib/nanoc/filters/sass.rb
nanoc-3.6.9 lib/nanoc/filters/sass.rb
nanoc-3.6.8 lib/nanoc/filters/sass.rb