Liferay连接并压缩javascript [英] Liferay concatenate and compress javascript

查看:62
本文介绍了Liferay连接并压缩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.propertiesjavascript.barebone.filesjavascript.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆