Add a custom JS library file to the Liferay

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.