Sha256: 804f8e370c7217ead9aaf73f8409910ccbc3d0e7276b7c9b62f9f0b5555c2da6

Contents?: true

Size: 663 Bytes

Versions: 190

Compression:

Stored size: 663 Bytes

Contents

require 'tilt/template'
require 'less'

module Tilt
  # Lessscss template implementation. See:
  # http://lesscss.org/
  #
  # Less templates do not support object scopes, locals, or yield.
  class LessTemplate < Template
    self.default_mime_type = 'text/css'

    def prepare
      if ::Less.const_defined? :Engine
        @engine = ::Less::Engine.new(data)
      else
        parser  = ::Less::Parser.new(options.merge :filename => eval_file, :line => line)
        @engine = parser.parse(data)
      end
    end

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

    def allows_script?
      false
    end
  end
end

Version data entries

190 entries across 151 versions & 25 rubygems

Version Path
tilt-2.0.11 lib/tilt/less.rb
brakeman-5.2.3 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/less.rb
brakeman-5.2.2 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/less.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/tilt-2.0.10/lib/tilt/less.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.10/lib/tilt/less.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.0.0/gems/tilt-2.0.10/lib/tilt/less.rb
brakeman-5.2.1 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/less.rb
brakeman-5.2.0 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/less.rb
brakeman-5.1.2 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/less.rb
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/lib/tilt/less.rb
brakeman-5.1.1 bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/less.rb