def _build(bundle_tp, bundle): items = [] for item in app.config.get(bundle_tp)[bundle]: items.append(preprocess(item)) # Add timestamp to avoid caching. items = ['%s?build=%s' % (item, get_mtime(item)) for item in items] return items
def _build(bundle_tp, bundle): items = [] for item in app.config.get(bundle_tp)[bundle]: items.append(preprocess(item)) # Add timestamp to avoid caching. items = [ '%s?build=%s' % (item, get_mtime(item)) for item in items ] return items
except urllib2.URLError, e: print ' - Invalid URL %s for %s, %s' % (url, filename, str(e.reason)) return None with open(file_path, 'w+') as fp: try: shutil.copyfileobj(req, fp) except shutil.Error: print ' - Could not copy file %s' % filename filename = os.path.join('external', filename) else: print ' - Not a valid remote file %s' % filename return None filename = preprocess(filename.lstrip('/')) if url is None and filename.endswith('.css'): filename = fix_urls(filename, compressed_file) tmp_files.append(filename) return get_path(filename.lstrip('/')) def minify(ftype, file_in, file_out): """Minify the file""" if ftype == 'js' and 'UGLIFY_BIN' in current_app.config: o = { 'method': 'UglifyJS', 'bin': current_app.config.get('UGLIFY_BIN') } subprocess.call("%s -o %s %s" % (o['bin'], file_out, file_in),
except urllib2.URLError, e: print ' - Invalid URL %s for %s, %s' % (url, filename, str(e.reason)) return None with open(file_path, 'w+') as fp: try: shutil.copyfileobj(req, fp) except shutil.Error: print ' - Could not copy file %s' % filename filename = os.path.join('external', filename) else: print ' - Not a valid remote file %s' % filename return None filename = preprocess(filename.lstrip('/')) if url is None and filename.endswith('.css'): filename = fix_urls(filename, compressed_file) tmp_files.append(filename) return get_path(filename.lstrip('/')) def minify(ftype, file_in, file_out): """Minify the file""" if ftype == 'js' and 'UGLIFY_BIN' in current_app.config: o = {'method': 'UglifyJS', 'bin': current_app.config.get('UGLIFY_BIN')} subprocess.call("%s -o %s %s" % (o['bin'], file_out, file_in), shell=True, stdout=subprocess.PIPE) elif ftype == 'css' and 'CLEANCSS_BIN' in current_app.config: