I\'m trying to reduce the number of scripts included in our website and we use buildout to handle deployments. Has anybody successfully implemented a method of combining and com
A slightly different take on the solution proposed by Rushabh. Rather than a file based compress function, this is string based and somewhat simpler:
def jsmerge(file_names, debug=False):
"""combines several js files together, with optional minification"""
js = ""
for file_name in file_names:
js += open(file_name).read()
# if debug is enabled, we skip the minification
if debug:
return js
else:
return jsmin(js)