Class: Distil::JavascriptBaseProduct

Inherits:
Product show all
Defined in:
lib/distil/product/javascript-base-product.rb

Direct Known Subclasses

JavascriptDebugProduct, JavascriptProduct

Instance Attribute Summary

Attributes inherited from Product

#assets, #join_string, #target

Attributes inherited from Configurable

#options

Instance Method Summary collapse

Methods inherited from Product

#clean, #external_files, #filename, #files, #files=, #handles_file?, #relative_path, #up_to_date, #write_output

Methods included from ErrorReporter

#error, error, #ignore_warnings, #ignore_warnings=, #report, warning, #warning

Methods inherited from Configurable

#get_option, #get_options, option

Constructor Details

#initialize(settings, target) ⇒ JavascriptBaseProduct

Returns a new instance of JavascriptBaseProduct.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/distil/product/javascript-base-product.rb', line 7

def initialize(settings, target)
  super(settings, target)
  
  @join_string=<<-eos
    
    /*jsl:ignore*/;/*jsl:end*/
    
  eos
  
  if bootstrap.nil?
    self.bootstrap= (APP_TYPE==target.target_type)
  end
end

Instance Method Details

#bootstrap_sourceObject



25
26
27
# File 'lib/distil/product/javascript-base-product.rb', line 25

def bootstrap_source
  @bootstrap_source||=File.read(bootstrap_script).strip
end

#can_embed_file?(file) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/distil/product/javascript-base-product.rb', line 21

def can_embed_file?(file)
  ["html", "js"].include?(file.content_type)
end

#copy_bootstrap_scriptObject



29
30
31
# File 'lib/distil/product/javascript-base-product.rb', line 29

def copy_bootstrap_script
  FileUtils.cp bootstrap_script, target.project.output_folder if !bootstrap
end