Class: Zwite::Compass

Inherits:
Plugin show all
Defined in:
lib/zwite/plugins/compass.rb

Instance Attribute Summary

Attributes inherited from Plugin

#app, #enabled

Instance Method Summary collapse

Methods inherited from Plugin

#enabled?, inherited, #initialize, #preprocess, subclasses

Constructor Details

This class inherits a constructor from Zwite::Plugin

Instance Method Details

#generateObject

Actions



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/zwite/plugins/compass.rb', line 19

def generate      
  sass_path = (self.app.path + "compass")
  cache_path = (self.app.path + ".cache/.compass-cache")
  to_path = (self.app.output_path + "static/stylesheets")
  
  args = [
    "compile",
    "-q",
    "--output-style",
    "compressed",
    "-e",
    "production",
    "--sass-dir",
    sass_path.to_s,
    "--css-dir",
    cache_path.to_s
  ]
  ::Compass::Exec::SubCommandUI.new(args).run!
  
  to_path.mkpath
  
  Dir[sass_path.to_s + "*/**"].each do |p|
    path = Pathname.new(p).sub_ext(".css")
    path_rel_path = path.relative_path_from(sass_path).to_s
    path_cached_path = cache_path + path_rel_path
    path_to_path = to_path + path_rel_path
    
    unless path_cached_path.exist?
      next
    end
    
    path_to_path.parent.mkpath
    FileUtils.cp(path_cached_path.to_s, path_to_path.to_s)
  end
  
end

#nameObject

Properties



11
12
13
# File 'lib/zwite/plugins/compass.rb', line 11

def name
 return "compass"
end