Sha256: 23fa23657872bcc805660992c4033a380d89b41d2372f2181e0b63efa0fedac9

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require 'malt/formats/abstract'
require 'malt/formats/css'
require 'malt/engines/sass'

module Malt::Format

  # SCSS Format
  #
  # This uses the same engine as Sass.
  class SCSS < Abstract

    register 'scss'

    #
    def scss(*)
      text
    end

    #
    def to_scss(*)
      self
    end

    #
    def css(data=nil, &yld)
      render_engine.render(:format=>:css, :text=>text, :file=>file, :type=>type)
    end

    #
    def to_css(data=nil, &yld)
      result = css(data, &yld)
      CSS.new(:text=>result, :file=>refile(:css), :type=>:css)
    end

    #
    #def compile(db, &yld)
    #  result = render_engine.render(text, db, &yld)
    #  opts = options.merge(:text=>result, file=>refile(:css))
    #  CSS.new(opts)
    #end

    #
    #def render_to(to, db, &yld)
    #  case to
    #  when :css
    #    malt_engine.render_css(text, file, db, &yld)
    #  else
    #    raise UnspportedConversion.new(type, to)
    #  end
    #end

    private

      #
      def render_engine
        @render_engine ||= Malt::Engine::Sass.new(options)
      end

      # Sass default output type is CSS.
      def default
        :css
      end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
malt-0.3.0 lib/malt/formats/scss.rb
malt-0.2.0 lib/malt/formats/scss.rb