Sha256: 7e6eda4da08bdc5e241183d3468faf244ffb034d2b52b13c256e9f0cc97758bd

Contents?: true

Size: 970 Bytes

Versions: 18

Compression:

Stored size: 970 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
      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

18 entries across 18 versions & 5 rubygems

Version Path
bsherman-compass-0.5.2 lib/compass/compiler.rb
chriseppstein-compass-0.4.0 lib/compass/compiler.rb
chriseppstein-compass-0.4.1 lib/compass/compiler.rb
chriseppstein-compass-0.4.2 lib/compass/compiler.rb
chriseppstein-compass-0.5.0 lib/compass/compiler.rb
chriseppstein-compass-0.5.1 lib/compass/compiler.rb
chriseppstein-compass-0.5.2 lib/compass/compiler.rb
chriseppstein-compass-0.5.3 lib/compass/compiler.rb
chriseppstein-compass-0.5.4 lib/compass/compiler.rb
chriseppstein-compass-0.5.5 lib/compass/compiler.rb
chriseppstein-compass-0.5.9 lib/compass/compiler.rb
chriseppstein-compass-0.6.0 lib/compass/compiler.rb
chriseppstein-compass-0.6.1 lib/compass/compiler.rb
chriseppstein-compass-0.6.2 lib/compass/compiler.rb
jsmestad-compass-0.4.2.1 lib/compass/compiler.rb
jwhitmire-compass-0.5.1.1 lib/compass/compiler.rb
jwhitmire-compass-0.5.1.2 lib/compass/compiler.rb
merbjedi-compass-0.5.0 lib/compass/compiler.rb