缩小JavaScript文件 minification-of-the-javascript-files
缩小会从源代码中删除冗余字符,如空格、新行和注释。 这会通过减小代码大小来提高性能。 虽然缩小不会影响功能,但会降低代码的可读性。
要生成缩小的代码以进行语义更改,请执行以下步骤。
-
复制
client-html/src/main/webapp/js
从文件系统上的src-package 。note note NOTE 请参阅 自定义AEM Forms工作区简介 以了解有关包的更多详细信息。 -
更新中的路径
main.js
位于client-html/src/main/webapp/js下,用于获取已添加/更新的模型/视图。例如,添加了新的“共享队列”模型(如mySharequeue),请更改:
code language-none sharequeuemodel : pathprefix + 'runtime/models/sharequeue', To sharequeuemodel : pathprefix + 'runtime/myModels/mySharequeue',
-
更新
registry-config.xml, located at client-html/src/main/webapp/js/resource_generator,
如果main.js
.例如,添加了新的“共享队列”模型(如mySharequeue),请更改:
code language-xml <sharequeue name="sharequeue" path="runtime/models/sharequeue.js" service="service"/> To <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
a6ebf046-2b8b-4543-bd46-42a0d77792da