SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast milko_leporis's Avatar
    Join Date
    Apr 2005
    Location
    Kisac, Vojvodina
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript compressing?

    What is best way to compress JavaScript?

    I used compressor on JavascriptCompressor.com to compress overlib.js and effects.js from scriptaculos and when I used them compressed on my site they didn't worked.

    Also I noticed that some compressors just eliminate all spaces, tabs and new lines from text, is that a good way to compress anything?

    Is there free program that compress JavaScript?

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Configure your webserver to serve files with gzip compression. Also make sure that it sends Etag and expiry headers, so the client is able to cache the script.

  3. #3
    SitePoint Enthusiast milko_leporis's Avatar
    Join Date
    Apr 2005
    Location
    Kisac, Vojvodina
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but I'm not shore that I know how to do those things, is there a book or site that explains that things?

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming that you're using Apache as webserver, you can use mod_expires to make sure that your files are cachable by the client, and mod_deflate to apply gz compression on the files, during transfer. The modules should be loaded in Apache's main configuration file (httpd.conf) and can then be enabled in a a per-directory config-file (.htaccess). If you're not running your own server, you may have to ask your host for help on this, but it's fairly default.
    Older versions of Internet Explorer may have some problems with mod_deflate. See this post, for a workaround for those browsers:
    http://j2s.sourceforge.net/blog/2007...-httpd-server/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •