Sha256: 87e506ce05b741540f95e593ef3885c8b80ff2f5d99555d3860b6d3ca400a5bf

Contents?: true

Size: 606 Bytes

Versions: 7

Compression:

Stored size: 606 Bytes

Contents

require 'tilt'

module Tilt
  ### stylus template implementation for `Tilt`.
  #
  # It can be used by the `Rails` 3.1 or `Sinatra` applications.
  class StylusTemplate < Template
    self.default_mime_type = 'text/css'

    def self.engine_initialized?
      defined? ::Stylus
    end

    def initialize_engine
      require_template_library 'stylus'
    end

    def prepare
      if self.file
        options[:filename] ||= self.file
      end
    end

    def evaluate(scope, locals, &block)
      @output ||= Stylus.compile(data, options)
    end
  end
end

Tilt.register Tilt::StylusTemplate, 'styl'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stylus-0.5.1 lib/stylus/tilt.rb
stylus-0.5.0 lib/stylus/tilt.rb
stylus-0.4.2 lib/stylus/tilt.rb
stylus-0.4.1 lib/stylus/tilt.rb
stylus-0.4.0 lib/stylus/tilt.rb
stylus-0.3.0 lib/stylus/tilt.rb
stylus-0.3.0.pre lib/stylus/tilt.rb