Module: Opal::Util

Extended by:
Util
Included in:
Util
Defined in:
opal/lib/opal/util.rb

Defined Under Namespace

Classes: Command, DigestSourceCommand

Instance Method Summary collapse

Instance Method Details

#gzip(str) ⇒ Object

Gzip code to check file size.



20
21
22
23
# File 'opal/lib/opal/util.rb', line 20

def gzip(str)
  gzip = DigestSourceCommand.new(:gzip, '-f', ', it is required to produce the .gz version')
  gzip.digest(str)
end

#uglify(str) ⇒ String

Used for uglifying source to minify.

Opal::Util.uglify("javascript contents")

Parameters:

  • str (String)

    string to minify

Returns:

  • (String)


14
15
16
17
# File 'opal/lib/opal/util.rb', line 14

def uglify(str)
  uglifyjs = DigestSourceCommand.new(:uglifyjs, '-c', ' (install with: "npm install -g uglify-js")')
  uglifyjs.digest(str)
end