Module: Guard::CompassHelper

Included in:
Compass
Defined in:
lib/guard/compass_helper.rb

Instance Method Summary collapse

Instance Method Details

#check_for_sass_files!(compiler) ⇒ Object

Excerpt from Compass updater commands #



28
29
30
31
32
33
34
# File 'lib/guard/compass_helper.rb', line 28

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

#new_compiler_instance(working_path) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/guard/compass_helper.rb', line 36

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

#pathname(*components) ⇒ Object

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.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/guard/compass_helper.rb', line 11

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