How to use rjsmin - 7 common examples

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)
github limodou / uliweb / uliweb / manage.py View on Github external
def process_file(self, sfile, dpath, dfile):
        from rjsmin.rjsmin import jsmin
        from rcssmin.rcssmin import cssmin

        js_compressor = None
        css_compressor = None

        if sfile.endswith('.js') and ('.min.' not in sfile and '.pack.' not in sfile) and (self.options.js or self.options.auto):
            open(dfile, 'w').write(jsmin(open(sfile).read()))
            if self.global_options.verbose:
                print 'Compress %s to %s' % (sfile, dfile)
            return True
        if sfile.endswith('.css') and ('.min.' not in sfile and '.pack.' not in sfile) and (self.options.css or self.options.auto):
            open(dfile, 'w').write(cssmin(open(sfile).read()))
            if self.global_options.verbose:
                print 'Compress %s to %s' % (sfile, dfile)
            return True
register_command(ExportStaticCommand)

rjsmin

Javascript Minifier

Apache-2.0
Latest version published 9 months ago

Package Health Score

66 / 100
Full package analysis

Popular rjsmin functions

Similar packages