Sha256: 5a684ceaa3a4c02d5710466fd3c2001321734586388fe4b984dab2618542541c

Contents?: true

Size: 1007 Bytes

Versions: 4

Compression:

Stored size: 1007 Bytes

Contents

module Compass
  class Compiler

    include Actions

    attr_accessor :working_path, :from, :to, :options

    def initialize(working_path, from, to, options)
      self.working_path = working_path
      self.from, self.to = from, to
      self.logger = options.delete(:logger)
      self.options = options
    end

    def sass_files
      @sass_files || Dir.glob(separate("#{from}/**/[^_]*.sass"))
    end

    def stylesheet_name(sass_file)
      sass_file[("#{from}/".length)..-6]
    end

    def css_files
      @css_files || sass_files.map{|sass_file| "#{to}/#{stylesheet_name(sass_file)}.css"}
    end

    def target_directories
      css_files.map{|css_file| File.dirname(css_file)}.uniq.sort.sort_by{|d| d.length }
    end

    def run
      Compass.configure_sass_plugin!
      target_directories.each do |dir|
        directory dir
      end
      sass_files.zip(css_files).each do |sass_filename, css_filename|
        compile sass_filename, css_filename, options
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chriseppstein-compass-0.6.3 lib/compass/compiler.rb
chriseppstein-compass-0.6.4 lib/compass/compiler.rb
chriseppstein-compass-0.6.5 lib/compass/compiler.rb
chriseppstein-compass-0.6.6 lib/compass/compiler.rb