broken long lines in minify
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.0.9 (2012-09-21 22:14:03) stable
|
||||
Version 2.0.9 (2012-09-21 22:23:39) stable
|
||||
|
||||
@@ -60,16 +60,18 @@ def minify(files, path_info, folder, optimize_css, optimize_js,
|
||||
processed = []
|
||||
for k,filename in enumerate(files):
|
||||
if not filename.startswith('/') or \
|
||||
any(filename.endswith(x) for x in ignore_concat):
|
||||
any(filename.endswith(x) \
|
||||
for x in ignore_concat):
|
||||
new_files.append(filename)
|
||||
continue
|
||||
|
||||
abs_filename = os.path.join(folder,'static',
|
||||
filename[len(static_path)+1:])
|
||||
abs_filename = os.path.join(
|
||||
folder,'static', filename[len(static_path)+1:])
|
||||
|
||||
if filename.lower().endswith('.css'):
|
||||
processed.append(filename)
|
||||
spath_info, sfilename = path_info.split('/'), filename.split('/')
|
||||
spath_info, sfilename = \
|
||||
path_info.split('/'), filename.split('/')
|
||||
u = 0
|
||||
for i,a in enumerate(sfilename):
|
||||
try:
|
||||
@@ -80,7 +82,8 @@ def minify(files, path_info, folder, optimize_css, optimize_js,
|
||||
pass
|
||||
if concat_css:
|
||||
contents = read_binary_file(abs_filename)
|
||||
replacement = '../'*len(spath_info[u:]) + '/'.join(sfilename[u:-1]) + '/'
|
||||
replacement = '../'*len(spath_info[u:]) + \
|
||||
'/'.join(sfilename[u:-1]) + '/'
|
||||
contents = fix_links(contents, replacement)
|
||||
if minify_css:
|
||||
css.append(cssmin.cssmin(contents))
|
||||
@@ -91,9 +94,12 @@ def minify(files, path_info, folder, optimize_css, optimize_js,
|
||||
elif filename.lower().endswith('.js'):
|
||||
processed.append(filename)
|
||||
if concat_js:
|
||||
contents = read_binary_file(abs_filename)
|
||||
if minify_js and not filename.endswith('.min.js') and \
|
||||
not any(filename.endswith(x) for x in ignore_minify):
|
||||
contents = read_binary_file(abs_filename)
|
||||
|
||||
if minify_js and \
|
||||
not filename.endswith('.min.js') and \
|
||||
not any(filename.endswith(x) \
|
||||
for x in ignore_minify):
|
||||
js.append(jsmin.jsmin(contents))
|
||||
else:
|
||||
js.append(contents)
|
||||
@@ -104,7 +110,8 @@ def minify(files, path_info, folder, optimize_css, optimize_js,
|
||||
css = '\n\n'.join(contents for contents in css)
|
||||
if not inline_css:
|
||||
temppath = os.path.join(folder,'static',temp)
|
||||
if not os.path.exists(temppath): os.mkdir(temppath)
|
||||
if not os.path.exists(temppath):
|
||||
os.mkdir(temppath)
|
||||
dest = "compressed_%s.css" % dest_key
|
||||
tempfile = os.path.join(temppath, dest)
|
||||
write_binary_file(tempfile,css)
|
||||
@@ -118,7 +125,8 @@ def minify(files, path_info, folder, optimize_css, optimize_js,
|
||||
js = ('js:inline',js)
|
||||
else:
|
||||
temppath = os.path.join(folder,'static',temp)
|
||||
if not os.path.exists(temppath): os.mkdir(temppath)
|
||||
if not os.path.exists(temppath):
|
||||
os.mkdir(temppath)
|
||||
dest = "compressed_%s.js" % dest_key
|
||||
tempfile = os.path.join(folder,'static',temp,dest)
|
||||
write_binary_file(tempfile,js)
|
||||
|
||||
+2
-1
@@ -241,7 +241,8 @@ class Response(Storage):
|
||||
|
||||
files = []
|
||||
for item in self.files:
|
||||
if not item in files: files.append(item)
|
||||
if not item in files:
|
||||
files.append(item)
|
||||
if have_minify and (self.optimize_css or self.optimize_js):
|
||||
# cache for 5 minutes by default
|
||||
key = hashlib.md5(repr(files)).hexdigest()
|
||||
|
||||
Reference in New Issue
Block a user