TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-19-2007, 01:53 PM   #1 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default JS Compressor

Salathe gave me link to a js compressor but after compressing my JS, it doesn't work.

I tried in different compressors but no use.

How do you compress your js?
Haris is offline  
Reply With Quote
Old 11-20-2007, 12:11 AM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

All JS compresses do is remove all the white space - it's all they can do. In the long run, if you're creating large Javascript files then Prototype will be able to shave a lot off of the file sizes due to the short-handed ways of writing the code. Such as $() instead of document.getElementById().

If you want to be your own Javascript compressor then once you're done, please all your Javascript on one huge line - of course keep another version that is formatted in a drop dead gorgeous way so that you can easily edit it. The good thing about Javascript is that it doesn't need the semi-colons at the end of each line, unlike PHP, and so removing those for each line will save you countless bytes!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 11-20-2007, 12:13 AM   #3 (permalink)
The Acquainted
 
Join Date: Sep 2007
Posts: 126
Thanks: 4
Sam Granger is on a distinguished road
Default

As mentioned through msn, try http://compressor.core.pathfinder.gr/

Hope it worked for you.
Sam Granger is offline  
Reply With Quote
Old 11-20-2007, 01:32 AM   #4 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

I linked Haris through to the widely used Packer (from Dean Edwards). If your JavaScript didn't work after being 'packed' chances are there's some non-standard thing in your code which the packer trips up on -- semi-colons being the usual culprit (they're essential since packed code is all on one line).

Wildhoney mentioned using Prototype to cut down on the amount of code that you have to write. Remember that you can compress Prototype down as well, and if you're using more modular libraries/frameworks (Mootools is a good example) then it really makes sense to only ever include the parts of the libraries/frameworks that you're going to be using (if that's possible).

Other popular compression tools include YUI Compressor, Douglas Crockford's JSMin and Dojo ShrinkSafe. I don't know if any of those have a web interface to copy/paste code from/into.
Salathe is offline  
Reply With Quote
Old 12-08-2007, 10:47 AM   #5 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default

I had to improve my syntax to compress the javascript with those tools.

dean.edwards packer worked flawlessly.
Haris is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:42 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design