Sha256: ba4bf45cb703856d200baf4850408d605eebfbbb6c40029a1e133b5205d6410c

Contents?: true

Size: 807 Bytes

Versions: 7

Compression:

Stored size: 807 Bytes

Contents

class Assette::Reader::Js < Assette::Reader(:js)
  
  def compile
    @file.text
  end
  
  class << self
    
    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
    end
    
    def comment_str
      '// %s'
    end
    
    def tag path
      <<-HTML
        <script src="#{path}" type="text/javascript"></script>
      HTML
    end

    def include path
      <<-JS
        (function() {
          var e = document.createElement('script'); e.async = false;
          e.src = '#{path}?nodep';
          document.getElementsByTagName('head')[0].appendChild(e);
        }());

      JS
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
assette-0.0.13 lib/assette/readers/js.rb
assette-0.0.12 lib/assette/readers/js.rb
assette-0.0.11 lib/assette/readers/js.rb
assette-0.0.10 lib/assette/readers/js.rb
assette-0.0.9 lib/assette/readers/js.rb
assette-0.0.8 lib/assette/readers/js.rb
assette-0.0.7 lib/assette/readers/js.rb