Skip to content

Commit

Permalink
Add text/javascript mimetype (#41)
Browse files Browse the repository at this point in the history
* Add text/javascript mimetype

* Update flask_compress.py
  • Loading branch information
dev-adas committed Apr 16, 2023
1 parent fa254e3 commit 4493c13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Within your Flask application's settings you can provide the following settings

| Option | Description | Default |
| ------ | ----------- | ------- |
| `COMPRESS_MIMETYPES` | Set the list of mimetypes to compress here. | `[`<br>`'text/html',`<br>`'text/css',`<br>`'text/xml',`<br>`'application/json',`<br>`'application/javascript'`<br>`]` |
| `COMPRESS_MIMETYPES` | Set the list of mimetypes to compress here. | `[`<br>`'application/javascript'`<br>`'application/json',`<br>`'text/css',`<br>`'text/html',`<br>`'text/javascript'`<br>`'text/xml'`<br>`]` |
| `COMPRESS_LEVEL` | Specifies the gzip compression level. | `6` |
| `COMPRESS_BR_LEVEL` | Specifies the Brotli compression level. Ranges from 0 to 11. | `4` |
| `COMPRESS_BR_MODE` | For Brotli, the compression mode. The options are 0, 1, or 2. These correspond to "generic", "text" (for UTF-8 input), and "font" (for WOFF 2.0). | `0` |
Expand Down
11 changes: 8 additions & 3 deletions flask_compress/flask_compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@ def __init__(self, app=None):

def init_app(self, app):
defaults = [
('COMPRESS_MIMETYPES', ['text/html', 'text/css', 'text/xml',
'application/json',
'application/javascript']),
('COMPRESS_MIMETYPES', [
'application/javascript', # Obsolete (RFC 9239)
'application/json',
'text/css',
'text/html',
'text/javascript',
'text/xml',
]),
('COMPRESS_LEVEL', 6),
('COMPRESS_BR_LEVEL', 4),
('COMPRESS_BR_MODE', 0),
Expand Down

0 comments on commit 4493c13

Please sign in to comment.