Skip to main content

quart_minify

Build Status Coverage Status

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

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:

from quart import Quart
from quart_minify.minify import Minify

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

Result:

Before:

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

After:

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

Options:

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

  • htmlmin: HTML python minifier.
  • lesscpy: Python less compiler and css minifier.
  • jsmin: JavaScript python minifier.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quart_minify-0.4.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quart_minify-0.4.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file quart_minify-0.4.1.tar.gz.

File metadata

  • Download URL: quart_minify-0.4.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Darwin/23.1.0

File hashes

Hashes for quart_minify-0.4.1.tar.gz
Algorithm Hash digest
SHA256 f7e458d0c29304962a69b04e869d99b002a696eb44686c2fa650985a6dceba2f
MD5 95319fd02c3b1e4dafc273341f04cd0b
BLAKE2b-256 8a46a881c52c364e6da23acb6f2166ee92a9fc9a4b2b5be7d1f91c4fbd6be8d6

See more details on using hashes here.

File details

Details for the file quart_minify-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: quart_minify-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Darwin/23.1.0

File hashes

Hashes for quart_minify-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14d1dd5ad57c55546e315907e2c9bc5ed15affcf816e9da802d779581c44c883
MD5 b66fe90ccd75cb29ccab1b969b2a5ad4
BLAKE2b-256 5ca5d4e068ca5d8b6ed9613e5b7f755a28ecd3ed771816acbc8519b9845702dc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page