Sha256: 59ec038781cb2fff02855be398fe0f05b2817ce355abbc8d349c088fb4d0f8a5

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

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
      self.options[:cache_location] ||= File.join(from, ".sass-cache")
    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

9 entries across 9 versions & 1 rubygems

Version Path
chriseppstein-compass-0.6.10 lib/compass/compiler.rb
chriseppstein-compass-0.6.11 lib/compass/compiler.rb
chriseppstein-compass-0.6.12 lib/compass/compiler.rb
chriseppstein-compass-0.6.13 lib/compass/compiler.rb
chriseppstein-compass-0.6.14 lib/compass/compiler.rb
chriseppstein-compass-0.6.15 lib/compass/compiler.rb
chriseppstein-compass-0.6.7 lib/compass/compiler.rb
chriseppstein-compass-0.6.8 lib/compass/compiler.rb
chriseppstein-compass-0.6.9 lib/compass/compiler.rb