Class: Guard::Jade
- Includes:
- Helpers::Starter
- Defined in:
- lib/guard/jade.rb
Instance Method Summary collapse
Instance Method Details
#act_on(directory, file) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/guard/jade.rb', line 15 def act_on(directory, file) target = target_filename(directory, file) FileUtils.mkdir_p(File.dirname(target)) if system("./node_modules/jade/bin/jade < #{file} > #{target}") mtime = File.mtime(file) File.utime(mtime, mtime, file) file else raise Exception.new("Failed to compile.") end end |
#target_filename(directory, file) ⇒ Object
11 12 13 |
# File 'lib/guard/jade.rb', line 11 def target_filename(directory, file) File.join(directory, File.basename(file).sub(/(\.html)?\.jade$/, '.html')) end |