Class: SSProto

Inherits:
Object
  • Object
show all
Defined in:
lib/ssproto.rb

Defined Under Namespace

Classes: Slim

Class Method Summary collapse

Class Method Details

.createObject



3
4
5
6
7
# File 'lib/ssproto.rb', line 3

def self.create
  require 'fileutils'
  FileUtils.cp_r(Dir["#{File.expand_path('../../template/',__FILE__)}/*"],Dir.pwd)
  self.watch
end

.watchObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ssproto.rb', line 8

def self.watch
  begin
  sass =Process.spawn("sass --watch sass/:css/ --style compressed")
  Process.detach sass
  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
  end
end