How to use the jsmin.__init__.JavascriptMinify function in jsmin

To help you get started, we’ve selected a few jsmin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tikitu / jsmin / jsmin / __init__.py View on Github external
def jsmin(js, **kwargs):
    """
    returns a minified version of the javascript string
    """
    if not is_3:        
        if cStringIO and not isinstance(js, unicode):
            # strings can use cStringIO for a 3x performance
            # improvement, but unicode (in python2) cannot
            klass = cStringIO.StringIO
        else:
            klass = StringIO.StringIO
    else:
        klass = io.StringIO
    ins = klass(js)
    outs = klass()
    JavascriptMinify(ins, outs, **kwargs).minify()
    return outs.getvalue()

jsmin

JavaScript minifier.

MIT
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis