quart_minify


Namequart_minify JSON
Version 0.4.1 PyPI version JSON
download
home_pagehttps://github.com/AceFire6/quart_minify
SummaryA Quart extension to minify quart response for html, javascript, css and less compilation as well.
upload_time2023-12-04 12:01:43
maintainer
docs_urlNone
authorJethro Muller
requires_python>=3.7
licenseMIT
keywords quart minify
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # quart_minify
[![Build Status](https://travis-ci.org/AceFire6/quart_minify.svg?branch=master)](https://travis-ci.org/AceFire6/quart_minify)
[![Coverage Status](https://coveralls.io/repos/github/AceFire6/quart_minify/badge.svg?branch=master)](https://coveralls.io/github/AceFire6/quart_minify?branch=master)

A Quart extension to minify quart response for html, javascript, css and less compilation as well.</h3>

## Install:
#### With pip
- `pip install quart-minify`

#### From the source:
- `git clone https://github.com/AceFire6/quart_minify.git`
- `cd quart_minify`
- `python setup.py install`

## Setup:
### Inside Quart app:

```python
from quart import Quart
from quart_minify.minify import Minify

app = Quart(__name__)
Minify(app=app)
```

### Result:

#### Before:
```html
<html>
  <head>
    <script>
      if (true) {
      	console.log('working !')
      }
    </script>
    <style>
      body {
      	background-color: red;
      }
    </style>
  </head>
  <body>
    <h1>Example !</h1>
  </body>
</html>
```
#### After:
```html
<html> <head><script>if(true){console.log('working !')}</script><style>body{background-color:red;}</style></head> <body> <h1>Example !</h1> </body> </html>
```

## Options:
```python
def __init__(self,
  app=None,
  html=True,
  js=False,
  cssless=True,
  cache=True,
  fail_safe=True,
  bypass=()):
  """
    A Quart extension to minify flask response for html,
    javascript, css and less.
    @param: app Quart app instance to be passed (default:None).
    @param: js To minify the css output (default:False).
    @param: cssless To minify spaces in css (default:True).
    @param: cache To cache minifed response with hash (default: True).
    @param: fail_safe to avoid raising error while minifying (default True).
    @param: bypass a list of the routes to be bypassed by the minifier
    Notice: bypass route should be identical to the url_rule used for example:
    bypass=['/user/<int:user_id>', '/users']
  """
```

## Credit:
Adapted from [flask_minify](https://github.com/mrf345/flask_minify)

- [htmlmin][1322354e]: HTML python minifier.
- [lesscpy][1322353e]: Python less compiler and css minifier.
- [jsmin][1322355e]: JavaScript python minifier.

[1322353e]: https://github.com/lesscpy/lesscpy "lesscpy repo"
[1322354e]: https://github.com/mankyd/htmlmin "htmlmin repo"
[1322355e]: https://github.com/tikitu/jsmin "jsmin repo"

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AceFire6/quart_minify",
    "name": "quart_minify",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "quart,minify",
    "author": "Jethro Muller",
    "author_email": "git@jethromuller.co.za",
    "download_url": "https://files.pythonhosted.org/packages/8a/46/a881c52c364e6da23acb6f2166ee92a9fc9a4b2b5be7d1f91c4fbd6be8d6/quart_minify-0.4.1.tar.gz",
    "platform": null,
    "description": "# quart_minify\n[![Build Status](https://travis-ci.org/AceFire6/quart_minify.svg?branch=master)](https://travis-ci.org/AceFire6/quart_minify)\n[![Coverage Status](https://coveralls.io/repos/github/AceFire6/quart_minify/badge.svg?branch=master)](https://coveralls.io/github/AceFire6/quart_minify?branch=master)\n\nA Quart extension to minify quart response for html, javascript, css and less compilation as well.</h3>\n\n## Install:\n#### With pip\n- `pip install quart-minify`\n\n#### From the source:\n- `git clone https://github.com/AceFire6/quart_minify.git`\n- `cd quart_minify`\n- `python setup.py install`\n\n## Setup:\n### Inside Quart app:\n\n```python\nfrom quart import Quart\nfrom quart_minify.minify import Minify\n\napp = Quart(__name__)\nMinify(app=app)\n```\n\n### Result:\n\n#### Before:\n```html\n<html>\n  <head>\n    <script>\n      if (true) {\n      \tconsole.log('working !')\n      }\n    </script>\n    <style>\n      body {\n      \tbackground-color: red;\n      }\n    </style>\n  </head>\n  <body>\n    <h1>Example !</h1>\n  </body>\n</html>\n```\n#### After:\n```html\n<html> <head><script>if(true){console.log('working !')}</script><style>body{background-color:red;}</style></head> <body> <h1>Example !</h1> </body> </html>\n```\n\n## Options:\n```python\ndef __init__(self,\n  app=None,\n  html=True,\n  js=False,\n  cssless=True,\n  cache=True,\n  fail_safe=True,\n  bypass=()):\n  \"\"\"\n    A Quart extension to minify flask response for html,\n    javascript, css and less.\n    @param: app Quart app instance to be passed (default:None).\n    @param: js To minify the css output (default:False).\n    @param: cssless To minify spaces in css (default:True).\n    @param: cache To cache minifed response with hash (default: True).\n    @param: fail_safe to avoid raising error while minifying (default True).\n    @param: bypass a list of the routes to be bypassed by the minifier\n    Notice: bypass route should be identical to the url_rule used for example:\n    bypass=['/user/<int:user_id>', '/users']\n  \"\"\"\n```\n\n## Credit:\nAdapted from [flask_minify](https://github.com/mrf345/flask_minify)\n\n- [htmlmin][1322354e]: HTML python minifier.\n- [lesscpy][1322353e]: Python less compiler and css minifier.\n- [jsmin][1322355e]: JavaScript python minifier.\n\n[1322353e]: https://github.com/lesscpy/lesscpy \"lesscpy repo\"\n[1322354e]: https://github.com/mankyd/htmlmin \"htmlmin repo\"\n[1322355e]: https://github.com/tikitu/jsmin \"jsmin repo\"\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Quart extension to minify quart response for html, javascript, css and less compilation as well.",
    "version": "0.4.1",
    "project_urls": {
        "Homepage": "https://github.com/AceFire6/quart_minify",
        "Repository": "https://github.com/AceFire6/quart_minify"
    },
    "split_keywords": [
        "quart",
        "minify"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ca5d4e068ca5d8b6ed9613e5b7f755a28ecd3ed771816acbc8519b9845702dc",
                "md5": "b66fe90ccd75cb29ccab1b969b2a5ad4",
                "sha256": "14d1dd5ad57c55546e315907e2c9bc5ed15affcf816e9da802d779581c44c883"
            },
            "downloads": -1,
            "filename": "quart_minify-0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b66fe90ccd75cb29ccab1b969b2a5ad4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5310,
            "upload_time": "2023-12-04T12:01:41",
            "upload_time_iso_8601": "2023-12-04T12:01:41.243210Z",
            "url": "https://files.pythonhosted.org/packages/5c/a5/d4e068ca5d8b6ed9613e5b7f755a28ecd3ed771816acbc8519b9845702dc/quart_minify-0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a46a881c52c364e6da23acb6f2166ee92a9fc9a4b2b5be7d1f91c4fbd6be8d6",
                "md5": "95319fd02c3b1e4dafc273341f04cd0b",
                "sha256": "f7e458d0c29304962a69b04e869d99b002a696eb44686c2fa650985a6dceba2f"
            },
            "downloads": -1,
            "filename": "quart_minify-0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "95319fd02c3b1e4dafc273341f04cd0b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3971,
            "upload_time": "2023-12-04T12:01:43",
            "upload_time_iso_8601": "2023-12-04T12:01:43.067648Z",
            "url": "https://files.pythonhosted.org/packages/8a/46/a881c52c364e6da23acb6f2166ee92a9fc9a4b2b5be7d1f91c4fbd6be8d6/quart_minify-0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-04 12:01:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AceFire6",
    "github_project": "quart_minify",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "quart_minify"
}
        
Elapsed time: 3.35079s