Class: EasyHtmlGenerator::Generator::Compile::Coffee

Inherits:
Base
  • Object
show all
Defined in:
lib/easy_html_generator/generator/compile/coffee.rb

Overview

this generator coffee sass files from src folder and copies them to the dist folder

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#dest_path, #do_file, #generate, #log, #log_running, #resolve_path_prefix, #should_do_file?, #src_path, #walk_files

Constructor Details

#initialize(project, config) ⇒ Coffee

Returns a new instance of Coffee.



10
11
12
13
14
15
# File 'lib/easy_html_generator/generator/compile/coffee.rb', line 10

def initialize(project, config)
  super(project, config)

  @config.src  = project.config.paths.src.scripts
  @config.dest = project.config.paths.dist.scripts
end

Instance Method Details

#do_input(input, src = 'inline') ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/easy_html_generator/generator/compile/coffee.rb', line 17

def do_input(input, src = 'inline')
  result = CoffeeScript.compile input

  return result unless @config.minimize

  EasyHtmlGenerator::Generator::Minimize::Js.compress result
rescue StandardError => e
  raise e, "#{e.message} in #{src} ", e.backtrace
end

#input_to_output_file(i) ⇒ Object



27
28
29
# File 'lib/easy_html_generator/generator/compile/coffee.rb', line 27

def input_to_output_file(i)
  super(i).gsub('.js.coffee', '.js')
end