How to use the rjsmin.jsmin function in rjsmin

To help you get started, we’ve selected a few rjsmin 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 daleobrien / maze / maze / renderers / js.py View on Github external
for j, row in enumerate(grid):
        js_row = []
        for i, cell in enumerate(row):
            js_row.append(TILES[cell])
        rows.append(f"[{','.join(js_row)}]")

    grid = f"const grid = [{','.join(rows)}]"

    folder, _ = os.path.split(os.path.realpath(__file__))
    svg_template = open(os.path.join(folder, 'js/render.mako.js')).read()

    js_content = Template(svg_template).render(a=a, a2=a2, b=b, b2=b2, g=g, n=n, r=r, s=s, q=q, v=v, delta=delta,
                                               theta=theta, grid=grid, s2=s/2.0, r2=b-a, r3=(s/2.0-a/2.0), r4=r4,
                                               width=options['width'], height=height, s_x_s=s_x_s, s_y_s=s_y_s)

    js_content = rjsmin.jsmin(js_content)

    return js_content
github Kitware / VTK / Web / JavaScript / Minimizer / build.py View on Github external
# write output to file
dir = os.path.dirname(args.m)
if not os.path.exists(dir):
  os.makedirs(dir);
with open(args.m,"w") as fp:
  fp.write(banner)
  fp.write(output.getvalue())

# write minimized output to file
dir = os.path.dirname(args.o)
if not os.path.exists(dir):
  os.makedirs(dir);
with open(args.o,"w") as fp:
  fp.write(banner)
  fp.write(rjsmin.jsmin(output.getvalue()))
github binaryage / dirac / scripts / inline_js_imports.py View on Github external
import_file = open(full_path, 'r')
        import_script = import_file.read()
        import_file.close()
        return import_script

    output_script = re.sub(r'importScripts?\([\'"]([^\'"]+)[\'"]\)', replace, input_script)
    if re.search("importScripts?\(\"", output_script):
        raise Exception('Unresolved "importScript" statements found in "%s". '
                        'Make sure you call "importScript" in module heads only.' %
                        (output_file_name))

    if os.path.exists(output_file_name):
        os.remove(output_file_name)
    output_file = open(output_file_name, 'w')
    if not no_minify:
        output_script = rjsmin.jsmin(output_script)
    output_file.write(output_script)
    output_file.close()

    # Touch output file directory to make sure that Xcode will copy
    # modified resource files.
    if sys.platform == 'darwin':
        output_dir_name = os.path.dirname(output_file_name)
        os.utime(output_dir_name, None)

rjsmin

Javascript Minifier

Apache-2.0
Latest version published 29 days ago

Package Health Score

76 / 100
Full package analysis

Popular rjsmin functions