In Liferay, if we want to use our own JS library (such as the EXT-JS Library) instead of the default AUI library, you can follow these steps:
(1) Place the library file
We go to the $liferay_home/tomcat-7.0.23/webapps/root/html/js directory to build a directory called ExtJS, and then copy ext-all.js into.
(2) Create the portal-ext.properties in the $liferay_home directory and then from the portal.properties in the Portal-impl.jar package Javascript.barebone.files This property and all of the file collections are copied in. Then add the Ext-js library file we want to include in the first line of the file collection: The following:
01.javascript.barebone.files=\
02.\
03. #
04. # ext-js
05. #
06. \
07. extjs/ext-all.js,\
08. \
09. #
10. # YUI core
11. #
12. \
13. aui/yui/yui.js,\
14. \
15. #
16. # YUI modules
17. #
18. \
19. aui/anim-base/anim-base.js,\
20. aui/anim-color/anim-color.js,\
21.
22....(都是从portal.properties中复制过来的)
The part that we want to add to see my yellow highlight part is to load the library file we need.
(3) In the $liferay_home/portal-ext.properties, we put
Javascript.fast.load is set to false, the advantage of this is that it does not produce a separate JS file (barebone.jsp or everything.jsp) that is compressed by yuicompressor, but instead displays all files that have not been compressed:
1.javascript.fast.load=false
Now that we're done, we open the browser, visit the home page, open F12, and in the resource view we can see that the ext-all.js we need is properly loaded in: