Class: Alula::Plugins::JavascriptAsset

Inherits:
GenericAsset
  • Object
show all
Defined in:
lib/alula/plugins/assets.rb

Instance Method Summary collapse

Methods inherited from GenericAsset

default, #initialize, #render, type

Constructor Details

This class inherits a constructor from Alula::Plugins::GenericAsset

Instance Method Details

#content(asset) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/alula/plugins/assets.rb', line 42

def content(asset)
  if File.size(File.join("public", asset)) < 10
    content = File.read(File.join("public", asset))
    unless content == ";"
      "<script type=\"text/javascript\">#{content}</script>"
    end
  else
    "<script type=\"text/javascript\" src=\"#{asset}\"></script>"
  end
end