Sha256: 2644ed8b342ed0b64f8f8d5f0cd1b38f9b7a903611f55eaa2da2bff12d63c0a6

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

require 'less'

class Assette::Reader::Less < Assette::Reader(:css)

  LESSC = !`which lessc`.empty?

  def compile args={}

    if LESSC
      Assette.logger.info("less running") {"cd #{@file.dirname} && lessc < #{@file.filename}"}
      `cd #{@file.dirname} && lessc #{@file.filename}`
    else
      parser = Less::Parser.new({
        :paths => [File.expand_path(@file.dirname)]|Assette.config.file_paths,
        :filename => @file.filename
      })

      tree = parser.parse(text)

      tree.to_css(options.merge(args))
    end
  end
  
private

  def options
    Assette.config.less
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
assette-0.1.3 lib/assette/readers/less.rb