Sha256: f7df7ce3bd7e2a1e70f4b2eda83f750a7731bb2eedf0a78be0aaf06d33952fca

Contents?: true

Size: 1.43 KB

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
guard-compass-1.1.0 lib/guard/compass_helper.rb
guard-compass-1.0.0 lib/guard/compass_helper.rb