A powerful HTML whitespace remover
Project description
HTML Whitespace remover for Django
Introduction :
A powerful tool to optimize HTML
Why use “django_stip_whitespace” ?
It speeds up website by reducing the HTML size.
Its mostly based on C ( gzip ) and Rust ( minify-html : https://pypi.org/project/minify-html/ ) libraries
Can be used with ‘django.middleware.gzip.GZipMiddleware’
It can automagically minify inline CSS, JS.
Significantly lower bytes transferred ( 246kb > 16kb ) when working with frameworks like AlpineJs and TailwindCSS
Why souldn’t you use django_stip_whitespace ?
This Module expects that you write js with line breaks.
So for example if you have a file like this:
<div x-init=" () => { console.log('Hello World') console.log("Hello World Again") // This will cause error because theres no ; } " > </div>
The resulted HTML will have an error and AlpineJS won’t init.
Disables the use of in HTML. Although this can be easily mitigated by using CSS pesudo element.
Use this:
selector::before { content : '\00a0\00a0' }
Requirements :
Brotli
minify-html
Django > 3 ( Should work with version 2? )
Python 3 ( Should work with all version? )
User guide :
Installation :
Install with pip from pypi:
python -m pip install django_stip_whitespace
Install with pip from github ( Development ):
python -m pip install https://codeload.github.com/baseplate-admin/django_strip_whitespace/zip/refs/heads/main
Then include it in your django project:
MIDDLEWARE = [ ... "strip_whitespace.middlewares.HtmlStripWhiteSpaceMiddleware.html_strip_whitespace", ]
Or if you like:
MIDDLEWARE += "strip_whitespace.middlewares.HtmlStripWhiteSpaceMiddleware.html_strip_whitespace"
Contributing :
I created this project to remove unnecessary Whitespace generated by AlpineJS. But feel free to Contribute in any way possible. If you like this project add a star.
Roadmap :
Add line break to InlineJS
Add ZStandard Compression ? ( Should Work )
Add PyPy support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for django_strip_whitespace-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5818890a6f830872ab7bf65813ad162e71ef7429c0de86bc444ce7112758b8d |
|
MD5 | 6f8b1e0e340c00aa100d74a80d0eb672 |
|
BLAKE2b-256 | c9f61468dfd3e1b0364073410a1085db226506b846cc7603166c9a4e372077f2 |