mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
38 lines
934 B
Python
38 lines
934 B
Python
#!/usr/bin/env python
|
|
|
|
import sys
|
|
sys.path.append('../../../build_tools/scripts')
|
|
import base
|
|
import os
|
|
|
|
params = sys.argv[1:]
|
|
|
|
#compilation_level = "WHITESPACE_ONLY"
|
|
compilation_level = "SIMPLE_OPTIMIZATIONS"
|
|
base.cmd("python", ["./min.py"])
|
|
|
|
min_content = base.readFile("./embed.min.js")
|
|
|
|
if (1 != len(params)):
|
|
exit(0)
|
|
|
|
api_file = params[0]
|
|
api_content = base.readFile(api_file)
|
|
|
|
pos_return_editor_obj = api_content.find("return {")
|
|
|
|
new_content = ""
|
|
new_content += min_content
|
|
new_content += "\n "
|
|
new_content += "function _createEmbedWorker() { return new AscEmbed._createEmbedWorker(); }"
|
|
new_content += "\n\n"
|
|
|
|
new_content += " return {"
|
|
new_content += "\n"
|
|
new_content += " createEmbedWorker : _createEmbedWorker,"
|
|
|
|
new_api_content = api_content[0:pos_return_editor_obj] + new_content + api_content[pos_return_editor_obj + 8:]
|
|
|
|
base.delete_file(api_file)
|
|
base.writeFile(api_file, new_api_content)
|