Class: Sassator::Compiler
- Inherits:
-
Object
- Object
- Sassator::Compiler
- Defined in:
- lib/sassator/compiler.rb
Instance Method Summary collapse
-
#initialize ⇒ Compiler
constructor
A new instance of Compiler.
- #run ⇒ Object
- #watch_folder(folder) ⇒ Object
Constructor Details
#initialize ⇒ Compiler
Returns a new instance of Compiler.
6 7 8 |
# File 'lib/sassator/compiler.rb', line 6 def initialize @monitor = FSSM::Monitor.new end |
Instance Method Details
#run ⇒ Object
30 31 32 33 |
# File 'lib/sassator/compiler.rb', line 30 def run puts "started monitoring" @monitor.run end |
#watch_folder(folder) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sassator/compiler.rb', line 10 def watch_folder(folder) @monitor.path folder, '*.sass' do puts "self is #{self}" update do |base, relative| puts "self is #{self}" puts "compiling #{relative}" content = File.read(File.join(base, relative)) engine = Sass::Engine.new(content, :style => :expanded) css =engine.render outfile = File.join(base, relative.gsub(/sass$/, "css")) File.open(outfile, "w") do |file| file.puts css end puts "css written to #{outfile}" end end puts "added #{folder} to watch list" end |