Sha256: 010e254d4713d3cd18ca1b24c66b22ee565ec596b7f7457131b221e885d82e78

Contents?: true

Size: 608 Bytes

Versions: 5

Compression:

Stored size: 608 Bytes

Contents

$jsl_import_regex= /\/\*jsl:import\s+([^\*]*)\*\//
$include_regex= /NIB\.asset\(['"]([^)]+)['"]\)/

class JavascriptFile < SourceFile

  def self.extension
    ".js"
  end

  def can_embed_as_content(file)
    [".css", ".html", ".json"].include?(file.extension)
  end

  def escape_embeded_content(content)
    content.gsub("\\", "\\\\").gsub("\n", "\\n").gsub("\"", "\\\"").gsub("'", "\\\\'")
  end

  def debug_content(options)
    destination= File.expand_path(options.remove_prefix||"")
    path= @file_path ? @file_path : self.relative_to_folder(destination)
    "loadScript(\"#{path}\");\n"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
distil-0.10.4 lib/file-types/javascript-file.rb
distil-0.10.3 lib/file-types/javascript-file.rb
distil-0.10.1 lib/file-types/javascript-file.rb
distil-0.10.0 lib/file-types/javascript-file.rb
distil-0.8.4 lib/file-types/javascript-file.rb