Method: Cyborg::Assets::Stylesheets#build

Defined in:
lib/cyborg/plugin/assets/stylesheets.rb

#build(ext = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cyborg/plugin/assets/stylesheets.rb', line 16

def build(ext=nil)
  files = find_files
  files = files.reject {|f| !f.match(/\.#{ext}/) } if ext

  files.each do |file|

    begin
      if File.extname(file).match(/\.css/)
        build_css(file)
      elsif File.extname(file).match(/\.s[ca]ss/)
        build_sass(file)
      end

      puts build_success(file)

    rescue Exception => e
      build_failure file

      if e.backtrace.is_a? Array
        log_error "Error in file: #{local_path(e.backtrace[0])}"
      end

    log_error "  #{e.message}\n" if e.message
    end
  end
end