def build(version, js_src, css_src=None, build_dir='.'): if not version: print('Error: You must provide a version.') sys.exit(2) if not js_src: print('Error: You must provide the location of the JavaScript source files.') sys.exit(2) # The order is very important due to some dependencies between scripts, so specify the dependency order here. dependencies = [ 'JSLITE.prototype.js', 'JSLITE.js', 'JSLITE.Element.js', 'JSLITE.Composite.js', 'JSLITE.Observer.js' ] # copyright = '''\ # /* # * jsLite {version!s} # * # * Copyright (c) 2009 - 2015 Benjamin Toll (benjamintoll.com) # * Dual licensed under the MIT (MIT-LICENSE.txt) # * and GPL (GPL-LICENSE.txt) licenses. # * # */ # '''.format(**locals()) # # # Write to a buffer. # buff = [textwrap.dedent(copyright)] js_output = 'JSLITE_' + version + '.min.js' css_output = 'JSLITE_CSS_' + version + '.min.js' js_compress.compress(js_src, js_output, build_dir, version, dependencies) if css_src: css_compress.compress(css_src, css_output, build_dir, version)
def build_app(html_out_path, js_in_path, css_in_path, scale) : scale = float(scale) cssx_map = gen_xmap.gen_cssx_map('.') js_code = js_compress.compress(js_in_path, cssx_map) css_code = css_compress.compress(css_in_path, scale, cssx_map) densitydpi = int(160 * scale) html_code = HTML_TEMPLATE % { 'dpr' : str(1 / scale), 'css' : css_code, 'js' : js_code, 'densitydpi' : densitydpi } html_file = open('google_app_engine_host/build/' + html_out_path, 'w') html_file.write(html_code) html_file.close() print 'Build APP Done'
def build_app(html_out_path, js_in_path, css_in_path, scale): scale = float(scale) cssx_map = gen_xmap.gen_cssx_map('.') js_code = js_compress.compress(js_in_path, cssx_map) css_code = css_compress.compress(css_in_path, scale, cssx_map) densitydpi = int(160 * scale) html_code = HTML_TEMPLATE % { 'dpr': str(1 / scale), 'css': css_code, 'js': js_code, 'densitydpi': densitydpi } html_file = open('google_app_engine_host/build/' + html_out_path, 'w') html_file.write(html_code) html_file.close() print 'Build APP Done'