Liferay连接并压缩javascript [英] Liferay concatenate and compress javascript
问题描述
我试图弄清楚如何对我所有的js文件进行压缩和压缩.目前,我将它们放在/html/js/mycustomjs/
文件夹下的一个hook插件中.
I am trying to figure out how to achieve compression and minification for all my js files. Currently i have them in a hook plugin under /html/js/mycustomjs/
folder.
我了解到liferay有其自己的机制来压缩javascript(在barebone.jsp或everything.jsp中),并在portal.properties
的javascript.barebone.files
和javascript.everything.files
属性中找到了声明的文件列表.
I understand that liferay has its own mechanism to compress javascripts, in barebone.jsp or everything.jsp, and found the list of files declared in the javascript.barebone.files
and javascript.everything.files
properties on portal.properties
.
问题是,我可以使用这种机制来压缩自己的js文件吗?我应该在portal-ext.properties
中覆盖此类属性吗?还是我应该自己一个人使用MinifierFilter
?
The question is, can i use this mechanism to compress js files of my own ? should i override such properties in the portal-ext.properties
? Or should i just use the MinifierFilter
by myself ?
此外,钩子插件是否是放置我希望在门户网站的所有站点上可用的js文件的正确位置?
Moreover, is a hook plugin the right place to put js files that i want available on all of the portal's sites?
推荐答案
覆盖portal-ext.properties
中的javascript.bundle.dependencies=
和javascript.bundle.ids=
属性,请参见
Override the javascript.bundle.dependencies=
and javascript.bundle.ids=
properties in portal-ext.properties
, see http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/javascri-3
类似这样的东西:
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
此外,我认为钩子插件不适合此类要求.我认为更好的方法是将javascript放在主题的中心.
Furthermore, I don't think that the hook plugin is a right place for such requirements. My opinion the better way is to put the javascripts central to the theme.
这篇关于Liferay连接并压缩javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!