Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 36548 invoked from network); 4 Nov 2009 07:05:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Nov 2009 07:05:56 -0000 Received: (qmail 62786 invoked by uid 500); 4 Nov 2009 07:05:55 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 62745 invoked by uid 500); 4 Nov 2009 07:05:55 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 62696 invoked by uid 99); 4 Nov 2009 07:05:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 07:05:55 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jerome.renard@gmail.com designates 209.85.218.221 as permitted sender) Received: from [209.85.218.221] (HELO mail-bw0-f221.google.com) (209.85.218.221) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 07:05:45 +0000 Received: by bwz21 with SMTP id 21so8443968bwz.24 for ; Tue, 03 Nov 2009 23:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=GIvaW4+hgNd79I+ZsKx0eJYovoq7xfQVpWTBOdFGM8s=; b=GzvzVkfuZWcskU8XqQyyQ8lWCQmiXY/fXPkB4tYBV7HzQXQ/uLsBIpox85z5i4iiop tKwUYol5L53Yc0rTw/BU1a0az9/PbSQ19HiFWIg5WKMlGM+ipV95VaPi/FoUk5tcfzkd zgt4g9To7OXWNO2orfmikzz2yNtmP8J0agvaM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=NfxX+pGXCzEiXfnx2pMbx0rVuq431eUQXhjhxjvSl62w6aSJpdFppk2b9VeOcDLOzJ 9nrvHT36uCKfKXiHXXnBGRPaKnIXoXgswXCixnIa5wT4lXlAVoM8t3u1ikz/tOcs00eY VS7sEgk99qG2CiP5sRT6dtKhclJ9e5xj55QlE= MIME-Version: 1.0 Received: by 10.204.156.19 with SMTP id u19mr1039662bkw.62.1257318325326; Tue, 03 Nov 2009 23:05:25 -0800 (PST) In-Reply-To: References: <17550da70911030248u1f70b2bduea5e2c75e7e9229e@mail.gmail.com> <17550da70911030340w50709807jf25db80f71f87861@mail.gmail.com> Date: Wed, 4 Nov 2009 08:05:25 +0100 Message-ID: <17550da70911032305i441a15d6k5551f40165021204@mail.gmail.com> Subject: Re: Minification of js files. From: Jerome Renard To: modules-dev@httpd.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Hello :) On Wed, Nov 4, 2009 at 5:42 AM, Jaysingh Samuel wrote: > > Hi, > Instead of minifying each of the javascript file separately and then using, is there a way of embedding the jsmin/(stripping of the blank lines) in the filter module of the apache so that the js file will be minified on the fly. Since there is a jsmin.c available here : http://www.crockford.com/javascript/jsmin.c I think you could bundle it in your module and use the JSMin API. However it might not make much sense to minify a javascript for every request. Do your Javascript files change that often ? I think you have to choose between the two following solutions : 1. To pre minify javascript files by running a shell/ant/Make script calling jsmin and push them in your HTTP directory 2. To minify Javascript files by embedding jsmin.c in a custom output filter module so it is done on the fly Pro and cons of option 1 are : Pro : easy to do, easy to maintain Cons : you have to run it after each update of you JS file(s), i.e it is not done on the fly Pro and cons of option 2 are : Pro : "minification" is done on the fly Cons : longer to create (you have to write C code), harder to maintain, will use much more server resources than option 1 It is up to you to make your decision based on your context. Hope that helps :)