In Files

Parent

Files

Class/Module Index [+]

Quicksearch

Hassle::Compiler

Public Instance Methods

compile() click to toggle source
# File lib/hassle.rb, line 63
def compile
  normalize
  prepare
  Sass::Plugin.update_stylesheets
end
compile_location(*subdirs) click to toggle source
# File lib/hassle.rb, line 31
def compile_location(*subdirs)
  File.join(Dir.pwd, "tmp", "hassle", subdirs)
end
css_location(path) click to toggle source
# File lib/hassle.rb, line 24
def css_location(path)
  expanded = File.expand_path(path)
  public_dir = File.join(File.expand_path(Dir.pwd), "public")

  File.expand_path(compile_location(expanded.gsub(public_dir, ''), '..'))
end
normalize() click to toggle source
# File lib/hassle.rb, line 35
def normalize
  template_location = options[:template_location]

  if template_location.is_a?(Hash) || template_location.is_a?(Array)
    options[:template_location] = template_location.to_a.map do |input, output|
      [input, css_location(input)]
    end
  else
    default_location = File.join(options[:css_location], "sass")
    options[:template_location] = {default_location => css_location(default_location)}
  end
end
options() click to toggle source
# File lib/hassle.rb, line 20
def options
  Sass::Plugin.options
end
prepare() click to toggle source
# File lib/hassle.rb, line 48
def prepare
  options.merge!(:cache        => false,
                 :never_update => false)

  options[:template_location].to_a.each do |location|
    FileUtils.mkdir_p(location.last)
  end
end
stylesheets() click to toggle source
# File lib/hassle.rb, line 57
def stylesheets
  options[:template_location].to_a.map do |location|
    Dir[File.join(location.last, "**", "*.css")].map { |css| css.gsub(compile_location, "/") }
  end.flatten.sort
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.