留言板

PB: obfuscated javascript in liferay 5.2.2, no debug possible

vince bruel,修改在15 年前。

PB: obfuscated javascript in liferay 5.2.2, no debug possible

New Member 帖子: 2 加入日期: 09-3-23 最近的帖子
Hello,
My javascripts are obfuscated by liferay 5.2.2, which they were not in my previous version (5.1.x).
I used to work (in 5.1.x) with firebug to debug javascript embeded in the portlet's war, which is no longer possible since
javascript have only one line: javascript seems to be obfuscated/compressed by the deployment module of liferay.
Does anyone knows how to tell liferay not to obfuscate/compress javascripts ?
May be there is a startup option somewhere to say that ?

Thanks in advance for your response.
thumbnail
Olaf Kock,修改在15 年前。

RE: PB: obfuscated javascript in liferay 5.2.2, no debug possible

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
you might want to set javascript.fast.load to false in your portal-ext.properties. See the default, make sure to set to true once debugging is finished (or generally: in production environments)
vince bruel,修改在15 年前。

RE: PB: obfuscated javascript in liferay 5.2.2, no debug possible

New Member 帖子: 2 加入日期: 09-3-23 最近的帖子
Thanks, it really helped me.
I solved the pb with two shell commands (if it could help someone else):

cat <<EOF > liferayDebugMode.sh
set -e
# Replace here YOUR_LIFERAY_HOME_DIRECTORY with your liferay's home directory
cd $YOUR_LIFERAY_HOME_DIRECTORY/tomcat-6.0.18/webapps/ROOT/WEB-INF/classes

# portal-developer.properties contains javascript.fast.load=false and other usefull things
cp portal-developer.properties portal-ext.properties
EOF

cat <<EOF > liferayProductionMode.sh
mv $YOUR_LIFERAY_HOME_DIRECTORY/tomcat-6.0.18/webapps/ROOT/WEB-INF/classes/portal-ext.properties /tmp
EOF

chmod a+x liferayDebugMode.sh liferayProductionMode.sh
thumbnail
Sohui Gu,修改在14 年前。

RE: PB: obfuscated javascript in liferay 5.2.2, no debug possible

Regular Member 帖子: 115 加入日期: 06-7-7 最近的帖子
Olaf Kock:
you might want to set javascript.fast.load to false in your portal-ext.properties. See the default, make sure to set to true once debugging is finished (or generally: in production environments)


That 's great,It works

Thanks very much, Olaf Kock
Emmr Jobe-Birn,修改在10 年前。

RE: PB: obfuscated javascript in liferay 5.2.2, no debug possible

New Member 帖子: 2 加入日期: 14-2-27 最近的帖子
Can anyone explain how to disable JavaScript obfuscation (or minifiy) in Liferay running on Windows Server 2008 R2?
It is causing our JavaScript code to fail by removing semicolons from the last line of code in each {} code block (any if statements, functions, try/catch, etc.), and it adds a semicolon after the last "}".
I posted full details in here.
Thanks
thumbnail
Olaf Kock,修改在10 年前。

RE: PB: obfuscated javascript in liferay 5.2.2, no debug possible

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
Emmr Jobe-Birn:
Can anyone explain how to disable JavaScript obfuscation (or minifiy) in Liferay...?


This can be done like I described above. Alternatively, add all the properties from portal-developer.properties. Careful: If you do this in production environments, your page load time will suffer a lot: Instead of one minified file you're now requesting potentially dozens of individual files - minification also minifies the number of files to be loaded to 1 css and 1 js file.

If you're running into a bug, you might want to file this on issues.liferay.com

Also, you're not mentioning which version of Liferay you're using - you're posting this as an answer to an article mentioning 5.2.2, which is horrendously old and unmaintained for years now - and you won't have any luck getting it fixed on that version. I've not had any problems with minification so far - wondering where you get yours.