Class: Pixiurge::TemplateView

Inherits:
Object
  • Object
show all
Defined in:
lib/pixiurge/template_view.rb

Overview

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#pixiurge_scriptsObject

HTML to include JavaScript for the appropriate Pixiurge scripts.

Since:

  • 0.1.0



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pixiurge/template_view.rb', line 4

def pixiurge_scripts
  out_html = ""
  pix_dir = File.join(__dir__, "..", "..", "pixiurge")
  Dir[File.join(pix_dir, "*.js")].sort.each do |js_file|
    filebase = File.basename(js_file)
    next if filebase == "webpack.config.js"
    out_html += "<script src=\"/pixiurge/#{filebase}\"></script>\n"
  end
  vendor_dir = File.join(__dir__, "..", "..", "vendor", "dev")
  Dir[File.join(vendor_dir, "*.js")].sort.each do |js_file|
    filebase = File.basename(js_file)
    out_html += "<script src=\"/vendor/#{filebase}\"></script>\n"
  end
  out_html
end