Sha256: 377bf7bb527434c55fbf356edaca874597d0057b2fe66996e6d0cf03f776e30d

Contents?: true

Size: 1.01 KB

Versions: 113

Compression:

Stored size: 1.01 KB

Contents

require 'tilt/template'

module Tilt
  # Sass template implementation. See:
  # http://haml.hamptoncatlin.com/
  #
  # Sass templates do not support object scopes, locals, or yield.
  class SassTemplate < Template
    self.default_mime_type = 'text/css'

    begin
      require 'sassc'
      Sass = ::SassC
    rescue LoadError => err
      begin
        require 'sass'
        Sass = ::Sass
      rescue LoadError
        raise err
      end
    end

    def prepare
      @engine = Sass::Engine.new(data, sass_options)
    end

    def evaluate(scope, locals, &block)
      @output ||= @engine.render
    end

    def allows_script?
      false
    end

  private
    def sass_options
      options.merge(:filename => eval_file, :line => line, :syntax => :sass)
    end
  end

  # Sass's new .scss type template implementation.
  class ScssTemplate < SassTemplate
    self.default_mime_type = 'text/css'

  private
    def sass_options
      options.merge(:filename => eval_file, :line => line, :syntax => :scss)
    end
  end

end

Version data entries

113 entries across 79 versions & 11 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/tilt-2.0.10/lib/tilt/sass.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/tilt-2.0.10/lib/tilt/sass.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/tilt-2.0.10/lib/tilt/sass.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/sass.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/sass.rb
brakeman-5.2.3 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/sass.rb
brakeman-5.2.2 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/sass.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/tilt-2.0.10/lib/tilt/sass.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.0.0/gems/tilt-2.0.10/lib/tilt/sass.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.10/lib/tilt/sass.rb
brakeman-5.2.1 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/sass.rb
brakeman-5.2.0 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/sass.rb
brakeman-5.1.2 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/sass.rb
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/sass.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/sass.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/sass.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/sass.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/sass.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/sass.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/sass.rb