Sha256: 0e404253d59c607b568de6bea5ba7d71701a9749a2ad1f410b28b7827fe44ab7

Contents?: true

Size: 706 Bytes

Versions: 19

Compression:

Stored size: 706 Bytes

Contents

require 'sass'

module Sprockets
  # This custom importer adds sprockets dependency tracking on to Sass
  # `@import` statements. This makes the Sprockets and Sass caching
  # systems work together.
  class SassImporter < Sass::Importers::Filesystem
    def initialize(context, root)
      @context = context
      super root.to_s
    end

    def find_relative(*args)
      engine = super
      if engine && (filename = engine.options[:filename])
        @context.depend_on_asset(filename)
      end
      engine
    end

    def find(*args)
      engine = super
      if engine && (filename = engine.options[:filename])
        @context.depend_on_asset(filename)
      end
      engine
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sprockets-2.7.1 lib/sprockets/sass_importer.rb
sprockets-2.6.1 lib/sprockets/sass_importer.rb
sprockets-2.5.1 lib/sprockets/sass_importer.rb
sprockets-2.4.6 lib/sprockets/sass_importer.rb
sprockets-2.3.3 lib/sprockets/sass_importer.rb
sprockets-2.8.0 lib/sprockets/sass_importer.rb
sprockets-2.7.0 lib/sprockets/sass_importer.rb
sprockets-2.6.0 lib/sprockets/sass_importer.rb
sprockets-2.5.0 lib/sprockets/sass_importer.rb
sprockets-2.4.5 lib/sprockets/sass_importer.rb
sprockets-2.4.4 lib/sprockets/sass_importer.rb
sprockets-2.4.3 lib/sprockets/sass_importer.rb
sprockets-2.4.2 lib/sprockets/sass_importer.rb
sprockets-2.4.1 lib/sprockets/sass_importer.rb
sprockets-2.4.0 lib/sprockets/sass_importer.rb
sprockets-2.3.2 lib/sprockets/sass_importer.rb
sprockets-2.3.1 lib/sprockets/sass_importer.rb
sprockets-2.3.0 lib/sprockets/sass_importer.rb
sprockets-2.3.0.beta lib/sprockets/sass_importer.rb