mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Add script for minimize js files
This commit is contained in:
28
Common/js/min.py
Normal file
28
Common/js/min.py
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../../../build_tools/scripts')
|
||||
import base
|
||||
import os
|
||||
|
||||
params = sys.argv[1:]
|
||||
|
||||
file_path = params[0]
|
||||
file_path_min = file_path + ".min.js"
|
||||
|
||||
compilation_level = "WHITESPACE_ONLY"
|
||||
#compilation_level = "SIMPLE_OPTIMIZATIONS"
|
||||
if (len(params) > 1):
|
||||
compilation_level = params[1]
|
||||
|
||||
base.cmd("java", ["-jar", "../../../sdkjs/build/node_modules/google-closure-compiler-java/compiler.jar",
|
||||
"--compilation_level", compilation_level,
|
||||
"--js_output_file", file_path_min,
|
||||
"--js", file_path])
|
||||
|
||||
min_content = base.readFile("../license/header.license") + base.readFile(file_path_min)
|
||||
|
||||
base.delete_file(file_path_min)
|
||||
base.delete_file(file_path)
|
||||
|
||||
base.writeFile(file_path, min_content)
|
||||
Reference in New Issue
Block a user