File: jsmin-noop.py

package info (click to toggle)
openjfx 8u141-b14-3~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 400,152 kB
  • sloc: cpp: 1,428,452; java: 748,581; ansic: 262,974; javascript: 189,623; python: 78,103; xml: 75,864; perl: 38,239; objc: 31,557; ruby: 16,170; asm: 5,072; sh: 3,959; yacc: 2,166; makefile: 2,011; lex: 906
file content (29 lines) | stat: -rw-r--r-- 733 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python

# This is a reimplementation of the JavaScript minifier included in OpenJFX
# which was derived from the non-free jsmin code by Douglas Crockford. This
# version simply copies the input file unchanged.
#
# -- Emmanuel Bourg <ebourg@apache.org>

try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO

def jsmin(js):
    ins = StringIO(js)
    outs = StringIO()
    JavascriptMinify().minify(ins, outs)
    return outs.getvalue()

class JavascriptMinify(object):

    def minify(self, instream, outstream):
        outstream.write(instream.read())
        instream.close()

if __name__ == '__main__':
    import sys
    jsm = JavascriptMinify()
    jsm.minify(sys.stdin, sys.stdout)