class Assette::Reader::Js
Public Class Methods
comment_str()
click to toggle source
# File lib/assette/readers/js.rb, line 23 def comment_str '// %s' end
error(str, path=nil)
click to toggle source
# File lib/assette/readers/js.rb, line 9 def error str, path=nil if path <<-JS console.group("Compiling Error in file #{path}"); console.error(#{str.to_json}); console.groupEnd(); JS else "console.error(#{str.to_json});" end "console.error(#{str.to_json});alert(#{str.inspect.to_json});" end
include(path)
click to toggle source
# File lib/assette/readers/js.rb, line 33 def include path # <<-JS # (function() { # var e = document.createElement('script'); e.async = false; # e.src = '#{path}?nodep'; # document.getElementsByTagName('head')[0].appendChild(e); # }()); # JS <<-JS document.write("<script src='#{path}?nodep'></script>") JS end
tag(path)
click to toggle source
# File lib/assette/readers/js.rb, line 27 def tag path <<-HTML <script src="#{path}" type="text/javascript"></script> HTML end
Public Instance Methods
compile()
click to toggle source
# File lib/assette/readers/js.rb, line 3 def compile @file.text end