Sha256: 9d6b7b9c56aa531ca12235fb087b140e01aa7851d31e254b902ab5c433f07a7b

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

Contents

require 'frozen/template/base'
require 'sass'

module Frozen
  module Template
    class Stylesheet < Base
      attr_accessor :options
      attr_accessor :file_load_path

      def initialize(options={})
        @options = {
          :style => :compressed,
          :format => nil,
          :load_path => nil
        }.merge(options)
      end

      def read_from_file(file)
        self.file_load_path = File.dirname(file)
        super(file)
      end

      def contents
        read_from_file(file_path)
      end

      def build_extension
        ".css"
      end

      def build_path
        "css"
      end

      def load_paths
        [options[:load_path], file_load_path]
      end

      def render
        engine = Sass::Engine.new(contents,
                                  :syntax => file_type.to_sym,
                                  :style => options[:style],
                                  :load_paths => load_paths)
        engine.render
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frozen-0.0.1 lib/frozen/template/stylesheet.rb