Sha256: 9c3716a732f820a9e80452ceff35db035b872181904baadfce1f722b1c59617d

Contents?: true

Size: 404 Bytes

Versions: 2

Compression:

Stored size: 404 Bytes

Contents

require 'yui/compressor'

Pakyow::Assets.preprocessor :js, fingerprint_contents: true do |path|
  content = File.open(path).read

  if Pakyow::Config.assets.minify
    begin
      YUI::JavaScriptCompressor.new(munge: true).compress(content)
    rescue YUI::Compressor::RuntimeError
      Pakyow.logger.warn "Unable to minify #{path}; using raw content"
      content
    end
  else
    content
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pakyow-assets-0.1.1 lib/preprocessors/javascript-preprocessor.rb
pakyow-assets-0.1.0 lib/preprocessors/javascript-preprocessor.rb