JavaScript文件的缩小 minification-of-the-javascript-files
缩小会从源代码中删除多余的字符,如空格、新行和注释。 这通过减小代码大小提高了性能。 虽然缩小不会影响功能,但它会降低代码的可读性。
要生成用于语义更改的缩小代码,请执行以下步骤。
-
从文件系统上的src-package复制
client-html/src/main/webapp/js
。note note NOTE 有关包的更多详细信息,请参阅自定义AEM Forms工作区简介。 -
为添加/更新的模型/视图,更新位于client-html/src/main/webapp/js下的
main.js
中的路径。例如,添加新的Sharequeue模型(如mySharequeue)会更改:
code language-javascript sharequeuemodel : pathprefix + 'runtime/models/sharequeue',
收件人
code language-javascript sharequeuemodel : pathprefix + 'runtime/myModels/mySharequeue',
-
在
main.js
中更改/添加别名时更新registry-config.xml, located at client-html/src/main/webapp/js/resource_generator,
。例如,添加新的Sharequeue模型(如mySharequeue)会更改:
code language-xml <sharequeue name="sharequeue" path="runtime/models/sharequeue.js" service="service"/>
收件人
code language-xml <sharequeue name="sharequeue" path="runtime/myModels/mySharequeue.js" service="service"/>
-
在client-html/src/main/webapp/js/minifier上,运行命令:
code language-shell mvn clean install
它生成一个缩小文件文件夹,位于client-html/src/main/webapp/js下,其中包含缩小的main.js和registry.js。
NOTE
缩小仅适用于64位JVM。
NOTE
如果缩小,您的升级将受到影响。
recommendation-more-help
19ffd973-7af2-44d0-84b5-d547b0dffee2