Class: Guard::Stylus
- Includes:
- Helpers::Starter
- Defined in:
- lib/guard/stylus.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/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 => [: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) ⇒ Object
11 12 13 |
# File 'lib/guard/stylus.rb', line 11 def target_filename(directory, file) File.join(directory, File.basename(file).sub(/(\.css)?\.styl$/, '.css')) end |