-
-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javescript compression in .htaccess #41
Comments
@sheixt Like I said before, can you try to include also the "media types" section (or at least this line) and tell me if that takes care of it. Also, make sure you have Note to self: As quite a few people only use parts of the |
By default the configurations from this repository ensure that `.js` files are served with the `application/javascript` media type, compressed, and with far future expires headers. However, not all users¹ use all the configurations provided by this project, or, in some cases, the headers are overwritten from the level "beneath" Apache (e.g.: from `php`). For most of these cases we can't do anything about it. Nonetheless, there is one, quite common case (the media type is set to `text/javascript`) where we can help. Since the `text/javascript` media type is used² quite often, this commit makes Apache serve anything labeled with this media type, compressed and with far future expires headers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ¹ #27 #41 ² Even the Google CND serves `.js` files with the `text/javascript` media type (e.g.: http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js)
Done in db69327. |
By default the configurations from this repository ensure that `.js` files are served with the `application/javascript` media type, compressed, and with far future expires headers. However, not all users¹ use all the configurations provided by this project, or in some cases, the headers are overwritten from the level "beneath" Apache (e.g.: from `php`). Looking at the results from the HTTP Archive² from 01.09.2014: +---+--------------------+--------------------------+ | | number of requests | media type | +---+--------------------+--------------------------+ | 1 | 7406888 | image/jpeg | | 2 | 4547461 | image/png | | 3 | 4003685 | image/gif | | 4 | 3087744 | text/html | * | 5 | 2112777 | text/javascript | | 6 | 1798370 | text/css | * | 7 | 1740983 | application/x-javascript | * | 8 | 1394717 | application/javascript | | | ... | ... | +---+--------------------+--------------------------+ it's clear that the `application/javascript` media type is used less often than both `text/javascript` and `application/x-javascript`. Because of the above, the changes from this commit will ensure that Apache will serve anything labeled with the `application/x-javascript`, compressed and with far future expires headers (a previous commit³ did the same for the files labeled as `text/javascript`). - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - ¹ #27 #41 ² https://www.igvita.com/2013/06/20/http-archive-bigquery-web-performance-answers/ Query used: select count(requestid) as number_of_requests, mimetype as media_type from [httparchive:runs.2014_09_01_requests] group by media_type order by number_of_requests desc; ³ db69327
I've used the 'compression' section of the
.htacess
file & noticed (thanks to gzipwtf.com) that the Javascript compression doesn't seem to work. It would seem there is a missing reference totext/javascript
.Here is the updated code snippet that I used, hope it helps:
[This has been migrated from https://github.com/h5bp/html5-boilerplate/issues/1592]
The text was updated successfully, but these errors were encountered: