mirror of
https://git.deluge-torrent.org/deluge
synced 2025-09-27 20:48:33 +00:00
Update minify script to use closure
This commit is contained in:
parent
489550fd7a
commit
a3073c44e2
2 changed files with 96 additions and 6 deletions
84
deluge/ui/web/js/extjs/ext-extensions.js
vendored
84
deluge/ui/web/js/extjs/ext-extensions.js
vendored
File diff suppressed because one or more lines are too long
|
@ -29,8 +29,13 @@ def module_exists(module_name):
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# slimit creates smallest file size
|
# Imports sorted by resulting file size.
|
||||||
if module_exists('slimit'):
|
if module_exists('closure'):
|
||||||
|
def minify_closure(file_in, file_out):
|
||||||
|
import subprocess
|
||||||
|
subprocess.call(['closure', '--js', file_in, '--js_output_file', file_out,
|
||||||
|
'-W', 'QUIET'])
|
||||||
|
elif module_exists('slimit'):
|
||||||
from slimit import minify
|
from slimit import minify
|
||||||
elif module_exists('jsmin'):
|
elif module_exists('jsmin'):
|
||||||
from jsmin import jsmin as minify
|
from jsmin import jsmin as minify
|
||||||
|
@ -79,6 +84,9 @@ def concat_src_files(file_list, fileout_path):
|
||||||
|
|
||||||
|
|
||||||
def minify_file(file_debug, file_minified):
|
def minify_file(file_debug, file_minified):
|
||||||
|
try:
|
||||||
|
minify_closure(file_debug, file_minified)
|
||||||
|
except NameError:
|
||||||
with open(file_minified, 'w') as file_out:
|
with open(file_minified, 'w') as file_out:
|
||||||
with open(file_debug, 'r') as file_in:
|
with open(file_debug, 'r') as file_in:
|
||||||
file_out.write(minify(file_in.read()))
|
file_out.write(minify(file_in.read()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue