Sha256: b6af168e61fa75a8364da5a6bbe9a424ff3e8c40d022f25c64ead8412e289ecc

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 Bytes

Contents

module Bunch
  class SassNode
    def initialize(fn)
      unless defined?(@@sass_required)
        require 'sass'
        @@sass_required = true
      end
      @filename = fn
    rescue LoadError
      raise "'gem install sass' to compile .sass and .scss files."
    end

    def contents
      @contents ||= Sass::Engine.for_file(@filename, {}).render
    end

    def name
      File.basename(@filename).sub(/\.s(c|a)ss$/, '')
    end

    def target_extension
      'css'
    end

    def inspect
      @filename.inspect
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bunch-0.0.4 lib/bunch/sass_node.rb
bunch-0.0.3 lib/bunch/sass_node.rb