class Guard::Stylus

Public Instance Methods

act_on(directory, file) click to toggle source
# File lib/guard/stylus.rb, line 15
def act_on(directory, file)
  target = target_filename(directory, file)
  FileUtils.mkdir_p(File.dirname(target))

  compiled = ::Stylus.compile(File.new(file), :compress => options[:compress])
  File.open(target, 'w') do |f|
    f.write(compiled)
  end
  mtime = File.mtime(file)
  File.utime(mtime, mtime, file)
  file
end
target_filename(directory, file) click to toggle source
# File lib/guard/stylus.rb, line 11
def target_filename(directory, file)
  File.join(directory, File.basename(file).sub(/(\.css)?\.styl$/, '.css'))
end