Re: Reducing js file sizes...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 20, 2009 at 3:49 AM, André Warnier <aw@xxxxxxxxxx> wrote:
> Brian Mearns wrote:
>>
>> On Thu, Mar 19, 2009 at 4:30 PM, Tony Anecito <adanecito@xxxxxxxxx> wrote:
>>>
>>> Hi All,
>>>
>>> Does anyone know of a module that would strip out the js file comments?
>>> Would be a great thing to have.
>>>
>>> Thanks,
>>> -Tony
>>>
>>
>> Not aware of a module specifically, but there are a number of programs
>> with and without source code floating around that do this. The keyword
>> you want to search for in "minify". I'm sure you could easily set up
>> an external filter to use one of them, or simply use a cgi script to
>> do it, and then your src can be included through that script, e.g.:
>> <script type='text/javscript'
>> src='/cgi-bin/minify.cgi?/url/to/myscript.js'></script>
>>
> Would that not prevent browser-level caching of the javascript ?
> If yes, that would probably more than cancel any advantage of the
> "minification", no ?
>
>

I don't see any specific reason it would. I believe caches work based
on the URL, including the query string, so it would identify each
script included in this was as a separate cacheable page. You may have
to generate some appropriate cache headers in the script, at a minimum
you'd want to generate a Date header.
Other than that, I think you'd be fine. You could probably test it
(even with just a simple CGI script before investing time in setting
up the minifier) by visiting a script, navigating away from it, then
putting your browser in offline mode. If you're able to revisit the
page in offline mode, that should mean it's cached.

Did you have some specific reason in mind why this would affect caching?

-Brian

-- 
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://pgp.mit.edu/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux