Sha256: e0872185b585af78fe7134663ddccd153aa59663a0c695f386b67ab8d631bdee

Contents?: true

Size: 390 Bytes

Versions: 4

Compression:

Stored size: 390 Bytes

Contents

# frozen_string_literal: true

require "digest/sha1"

module HtmlPress
  def self.content_cache
    @content_cache ||= {}
  end

  def self.js_compressor(text, options = nil)
    options ||= {}
    options[:output] ||= {inline_script: true}

    hash = Digest::SHA1.hexdigest(text)
    content_cache[hash] ||= MultiJs.compile(text, options).gsub(/;$/, "")
    content_cache[hash]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
troy-0.0.39 lib/troy/hacks.rb
troy-0.0.38 lib/troy/hacks.rb
troy-0.0.37 lib/troy/hacks.rb
troy-0.0.36 lib/troy/hacks.rb