Liferay merges and compresses javascript

I am trying to understand how to achieve compression and minimization for all my js files. I currently have them in a plugin with hooks in the /html/js/mycustomjs/ .

I understand that liferay has its own javascripts compression engine, in barebone.jsp or everything.jsp, and found a list of files declared in the javascript.barebone.files and javascript.everything.files properties on portal.properties .

The question is, can I use this mechanism to compress my own js files? Should I override such properties in portal-ext.properties ? Or should I just use MinifierFilter myself?

In addition, is the hook plugin the right place to host the js files that I want to receive on all portal sites?

+4
source share
1 answer

Override the properties javascript.bundle.dependencies= and javascript.bundle.ids= in portal-ext.properties , see http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/ javascri-3

Something like that:

 javascript.my.files =\ jquery-1.8.3.js,\ my-script.js javascript.bundle.ids=\ javascript.barebone.files,\ javascript.everything.files,\ javascript.my.files javascript.bundle.dependencies[javascript.barebone.files]=javascript.my.files 

Also, I don't think the hook plugin is the right place for such requirements. My opinion, the best way is to put javascripts in the center of the topic.

+3
source

Source: https://habr.com/ru/post/1480674/


All Articles