Sha256: 6b619c3f6ff81658ec6c2ae27276a4eab9c7e07b26f69e48314aaffc7c47a954

Contents?: true

Size: 1.04 KB

Versions: 73

Compression:

Stored size: 1.04 KB

Contents

module Haml
  module Filters
    # This is an extension of Sass::Rails's SassTemplate class that allows
    # Rails's asset helpers to be used inside Haml Sass filter.
    class SassRailsTemplate < ::Sass::Rails::SassTemplate
      def render(scope=Object.new, locals={}, &block)
        scope = ::Rails.application.assets.context_class.new(::Rails.application.assets, "/", "/")
        super
      end

      def sass_options(scope)
        options = super
        options[:custom][:resolver] = ::ActionView::Base.new
        options
      end
    end

    # This is an extension of Sass::Rails's SassTemplate class that allows
    # Rails's asset helpers to be used inside a Haml SCSS filter.
    class ScssRailsTemplate < SassRailsTemplate
      self.default_mime_type = 'text/css'

      def syntax
        :scss
      end
    end

    remove_filter :Sass
    remove_filter :Scss
    register_tilt_filter "Sass", :extend => "Css", :template_class => SassRailsTemplate
    register_tilt_filter "Scss", :extend => "Css", :template_class => ScssRailsTemplate
  end
end

Version data entries

73 entries across 65 versions & 10 rubygems

Version Path
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
brakeman-4.6.1 bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
brakeman-4.6.0 bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/haml-4.0.7/lib/haml/sass_rails_filter.rb