Sha256: af24f64717e1b55e297179342738d8de43e9ca5975bcf5c9dd67a3a28a647ab1

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

require 'compass'
require 'compass/commands'
require 'compass/commands/project_base'
require 'compass/compiler'

module Guard
  module CompassHelper
    # Build a path agains components that might be relative or absolute.
    # Whenever an absolute component is found, it became the new 
    # base path on which next relative components are built.
    def pathname(*components)
      result = Pathname.pwd
      components.each do |c|
        pc = Pathname.new(c)
        if(pc.relative?)
          result = result + pc
        else
          result = pc
        end
      end
      return result
    rescue
      raise "Cannot process #{components.inspect}: #{$!}"
    end
    
    # Excerpt from Compass updater commands #

    def check_for_sass_files!(compiler)
      if compiler.sass_files.empty?
        message = "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\n"
        message << "Run \"compass -h\" to get help."
        raise Compass::Error, message
      end
    end

    def new_compiler_instance(working_path)
      compiler_opts = ::Compass.sass_engine_options
      compiler_opts.merge!(:quiet => options[:quiet],
                           :force => options[:force],
                           :dry_run => options[:dry_run])
      ::Compass::Compiler.new(working_path,
        ::Compass.configuration.sass_path,
        ::Compass.configuration.css_path,
        compiler_opts)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
guard-compass-0.0.8 lib/guard/compass_helper.rb