Minifies HTML files generated by Pelican
Project description
pelican-htmlmin
A Pelican plugin that uses htmlmin to remove comments and extra whitespace from your website after the pages have been generated.
Turning this:
<html>
<head>
<title> Hello, World! </title>
</head>
<body>
<p> How <em>you</em> doing? </p>
</body>
</html>
Into this:
<html><head><title>Hello, World!</title><body><p> How <em>you</em> doing? </p></body></html>
Installing
pelican-htmlmin
, is available on pip:
$ pip install pelican-htmlmin
After you’ve installed the package, update the PLUGINS
variable in your
pelicanconf.py
to include the package in the next pelican build.
PLUGINS = [
# ...
'pelican-htmlmin',
# ...
]
Options
HTMLMIN_DEBUG
To help with debugging, if Pelican is in DEBUG mode, pelican-htmlmin
will not minify files. You can override this using the HTMLMIN_DEBUG
:
# minify generated files only if pelican is in DEBUG mode
HTMLMIN_DEBUG = logger.getEffectiveLevel() == logging.DEBUG
HTMLMIN_MATCH
By default, pelican-htmlmin
looks for files ending with .html
or .htm
to minify. Use the HTMLMIN_MATCH
to update the regular
expression that matches with the files you wish to minify.
HTMLMIN_MATCH = r'.html?$'
HTMLMIN_OPTIONS
If you wish to pass arguments to htmlmin
directly, use the
HTMLMIN_OPTIONS
in {key: value}
form.
HTMLMIN_OPTIONS = {
'remove_commends': True,
'remove_all_empty_space': True,
'remove_optional_attribute_quotes': False
}
For more information on the arguments you can give htmlmin
, see their
documentation here
Contributing
Please feel free to help. Issues, pull requests, and patches via email, all are warmly welcomed.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pelican_htmlmin-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba85c04009ac0b9abb89ce152ef35aff07c9491ecd4b286c2abd84b00d3b3006 |
|
MD5 | 87cca2a8d07a9270638b89ae26d73996 |
|
BLAKE2b-256 | 0a63f73c35405ced3684882946871b07768c22356f155133cd8325c38ba40aa1 |