Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
Posts: 10
Registered: ‎02-08-2012
My Device: Blackberry Playbook 2.0
My Carrier: WIND

Minifying JS

Hi guys,

 

I ran into an interesting issue last night - I minified my JS using the Google Closure compiler, and packaged the app with webworks into a playbook app and loaded that onto my tablet for testing. The web inspector showed that the minified JS file was there, but the content was blank. Is there some size limit for the JS file? The minified JS contained all my various JS files into one, for loading optimization.

 

Help is appreciated,

Thanks

 

dSolver

 

Building amazing things with limited tools is my job.
Developer
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: Minifying JS

Are you sure that the JS file in the bar file isn't blank?
This usually happen in case of parsing errors.
--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
New Developer
Posts: 10
Registered: ‎02-08-2012
My Device: Blackberry Playbook 2.0
My Carrier: WIND

Re: Minifying JS

My suspicion is that the JS file is blank in the bar file, however I'm unsure of the cause... I used the Closure Compiler, but if there's another JS minifier that works well with blackberries, please let me know!

 

Also, the minified JS works fine when I'm accessing it through the browser, which really confused me. Perhaps something happens to the JS when being packaged into a Bar file?

Building amazing things with limited tools is my job.
Developer
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: Minifying JS

Just unzip the bar file and you'll know right away :smileywink:

 

Closure is quite picky and you need well documented code to make it work at level 2.

Try YUI Compressor or UglifyJS

 

Having said that, you might simply have a missing semicolon or an extra comma which doesn't break your browser, but breaks minification.

Load your files in a parser or IDE and you should see right away where the problem lies.

 

 

 

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
New Developer
Posts: 10
Registered: ‎02-08-2012
My Device: Blackberry Playbook 2.0
My Carrier: WIND

Re: Minifying JS

Awesome! Thanks for the tip!

Building amazing things with limited tools is my job.