Class: Blacksmith::Application

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

Instance Method Summary collapse

Instance Method Details

#buildObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/blacksmith/application.rb', line 13

def build
  files = Blacksmith.config.build_files

  files.each do |f|
    output = Preprocessor.proccess(f)

    if Blacksmith.config.jshint
      puts Jshintrb.report(["#{Blacksmith.config.source_folder}/#{f}.js"]) #need pullrequest Jshintrb
    end

    if Blacksmith.config.env == :production
      output = Uglifier.compile(output)
    end

    output_file = File.new(output_filename_helper(f), 'w')
    output_file.write(output)


    if Blacksmith.config.gzip
      output_file_gzip = File.new(output_filename_helper(f, :gzip => true), 'w')
      output_file_gzip.write(output.gzip)
    end
  end

  puts 'Build successfully.'
end

#rootObject



8
9
10
# File 'lib/blacksmith/application.rb', line 8

def root
  @root ||= Dir.pwd
end