Sha256: c23e414ae3500fefdfb205d73e78880ddd901e2a72f9d4f66052af0114c4a45a

Contents?: true

Size: 652 Bytes

Versions: 6

Compression:

Stored size: 652 Bytes

Contents

require 'sass-json-vars/importer'

# Taken from https://github.com/chriseppstein/sass-css-importer/blob/master/lib/sass/css_importer/monkey_patches.rb
# TODO: This feels wrong, surely there must be a better way to handle this

class Sass::Engine
  alias initialize_without_json_importer initialize

  def initialize(template, options={})
    initialize_without_json_importer(template, options)

    json_importer = self.options[:load_paths].find {|lp| lp.is_a?(SassJSONVars::Importer) }

    unless json_importer
      root = File.dirname(options[:filename] || ".")
      self.options[:load_paths] << SassJSONVars::Importer.new(root)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sass-json-vars-0.3.3 lib/sass-json-vars/monkeypatch.rb
sass-json-vars-0.3.2 lib/sass-json-vars/monkeypatch.rb
sass-json-vars-0.3.1 lib/sass-json-vars/monkeypatch.rb
sass-json-vars-0.3.0 lib/sass-json-vars/monkeypatch.rb
sass-json-vars-0.2.1 lib/sass-json-vars/monkeypatch.rb
sass-json-vars-0.2.0 lib/sass-json-vars/monkeypatch.rb