8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/ssproto.rb', line 8
def self.watch
begin
sass =Process.spawn("sass --watch sass/:css/ --style compressed")
Process.detach sass
coffee = Process.spawn("coffee -o js -cw coffee")
Process.detach coffee
SSProto::Slim.setSlimOptions :pretty => true,:sort_attrs => false
directories_to_watch = ["index.slim","config.rb","css/","js/"]
puts "Watching:\n #{directories_to_watch.join("\n ")}\n"
FileWatcher.new(directories_to_watch).watch do |f|
puts "Rendering index.html"
SSProto::Slim.renderSlim("#{Dir.pwd}/index.slim","#{Dir.pwd}/index.html")
puts " finished"
end
rescue SystemExit, Interrupt
Process.kill "SIGINT",sass
Process.kill "SIGINT",coffee
end
end
|