Class: Hanami::Assets::Compressors::BuiltinJavascript Private

Inherits:
Javascript show all
Defined in:
lib/hanami/assets/compressors/builtin_javascript.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Builtin compressor for stylesheet

This is a port of jsmin Copyright © 2002 Douglas Crockford (www.crockford.com)

This Ruby port was implemented by Ryan Grove (@rgrove) as work for jsmin gem.

Copyright © 2008-2012 Ryan Grove

Instance Method Summary collapse

Methods inherited from Javascript

for

Constructor Details

#initializeBuiltinJavascript

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of BuiltinJavascript.

Since:

  • 0.1.0



22
23
24
# File 'lib/hanami/assets/compressors/builtin_javascript.rb', line 22

def initialize
  @compressor = JSMin
end

Instance Method Details

#compress(filename) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



28
29
30
31
32
# File 'lib/hanami/assets/compressors/builtin_javascript.rb', line 28

def compress(filename)
  compressor.minify(
    read(filename)
  )
end