[![pipeline status](https://gitlab.com/octomy/web-minify/badges/production/pipeline.svg)](https://gitlab.com/octomy/web-minify/-/commits/production)
<!---
## ## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ##
## ## ## ## ##
## ## ##
##
WARNING: This file is AUTO GENERATED from "tpl_README.md".
Any changes you make will be OVERWRITTEN at the
next invocation of `make readme`
##
## ## ##
## ## ## ## ##
## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ## ##
-->
# About web-minify (version 1.1.2-test-development)
<img src="https://gitlab.com/octomy/web-minify/-/raw/production/design/logo-1024.png" width="20%"/>
__web-minify__ is the all-in-one just-works-out-of-the-box does-what-you-want highly-opinionated web minifier™
- web-minify is [available on gitlab](https://gitlab.com/octomy/web-minify).
## Goals of this tool:
> NOTE: We have not reached all these goals yet, please see next sections.
| Goal | Status |
|--------|-------------|
| All-in-one compressor/obfuscator/minifier/cruncher for most of the common static web formats | See [list of supported formats](#supported-formats). | ✅ |
| Installable via PyPi on platforms supported by Python 3+ | ✅ |
| No dependencies on large non-python tool such as nodejs | ✅ |
| Support for images formats such as [.png](https://en.wikipedia.org/wiki/Portable_Network_Graphics) and [.jpeg](https://en.wikipedia.org/wiki/JPEG) | ✅ |
| Support for vector graphics formats such as [.svg](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) | ✅ |
| Support for style sheet formats such as .css and [.sass](https://en.wikipedia.org/wiki/Sass_(stylesheet_language) | ✅ |
| Support for script formats such as .js | ✅ |
| Support for template formats such as .jinja | ✅ |
| Support for markup formats such as .html | ✅ |
| Handle intertwined formats such as JS and CSS inside HTML | ❌ |
| Does what you hoped by default (i.e. highly opinionated) | ✅ |
| Can be tweaked to do what you didn't want (i.e. flexible) | ✅ |
| Small and dependency free (i.e. implemented in pure python if possible) | Only tested/used on Linux. There is hope for OSX/BSD/Posix but YMMV on Windows. |
| Available as library as well as command-line tool | ✅ |
| Easily extensible; adding another backend can be done by writing one function | ✅ |
| Cross platform, supports many Python 3.x versions | Only tested on Python 3.7 |
# Getting started
__web-minify__ can be used and hacked on in a myriad of different ways.
## Use web-minify as a module from your code
web-minify is [available in PyPI](https://pypi.org/project/web-minify/).
```shell
# Install web-minify into your current Python environment
pip install web-minify
```
Now you can access it's features from your code:
<details>
```Python
import web_minify
settings = {
"input": "my_originals_dir/",
"output": "my_processed_dir/",
}
# Instanciate processor with settings we want to use
p = web_minify.processor.Processor(settings)
# Process files as per settings (this is equivalent to the commandline mode)
p. process_file()
# Process a list of files relative to input, and output them depending on settings
p. process_files_list(["input_file.svg", "input_file.html"])
# Process a single file (disregard input/output from settings
p.process_file("some_input_file.svg", "some_output_file.svg")
```
</details>
## Use web-minify as a command line tool
web-minify is [available in PyPI](https://pypi.org/project/web-minify/).
```shell
# Install web-minify into your current Python environment
pip install web-minify
```
```shell
# Run the web-minify cli tool with help argument to see detailed usage
web-minify --help
```
The output looks like this:
<details>
```shell
$ ./web-minify.py --help
usage: web-minify.py [-h] [--version] [--mode {Mode.minify,Mode.beautify}]
[--format FORMAT] [--overwrite] [--on-change] [--verbose]
[--quiet] [--dry-run] [--copy] [--force] [--diff]
[--no-size-checks] [--size-max NUM] [--size-min NUM]
[--nproc NUM] [--gzip] [--disable-type-svg]
[--disable-type-sql] [--disable-type-json]
[--disable-type-css] [--disable-type-png]
[--disable-type-sass] [--disable-type-html]
[--disable-type-jinja] [--disable-type-js]
[--disable-type-jpeg] [--disable-extension-svg]
[--disable-extension-jinja2]
[--disable-extension-template] [--disable-extension-sql]
[--disable-extension-pgsql] [--disable-extension-jpg]
[--disable-extension-css] [--disable-extension-json]
[--disable-extension-htm] [--disable-extension-png]
[--disable-extension-tpl] [--disable-extension-sass]
[--disable-extension-html] [--disable-extension-scss]
[--disable-extension-j2] [--disable-extension-jinja]
[--disable-extension-js] [--disable-extension-jpeg]
[--output OUTPUT] [--sort] [--comments] [--timestamp]
[--wrap] [--set-precision NUM] [--set-c-precision NUM]
[--disable-simplify-colors] [--disable-style-to-xml]
[--disable-group-collapsing] [--create-groups]
[--keep-editor-data] [--keep-unreferenced-defs]
[--renderer-workaround] [--no-renderer-workaround]
[--strip-xml-prolog] [--remove-titles]
[--remove-descriptions] [--remove-metadata]
[--remove-descriptive-elements]
[--enable-comment-stripping] [--disable-embed-rasters]
[--enable-viewboxing] [--indent TYPE] [--nindent NUM]
[--no-line-breaks] [--strip-xml-space]
[--enable-id-stripping] [--shorten-ids]
[--shorten-ids-prefix PREFIX] [--protect-ids-noninkscape]
[--protect-ids-list LIST] [--protect-ids-prefix PREFIX]
[--error-on-flowtext]
input
optional arguments:
-h, --help show this help message and exit
general:
General options for this program
--version show program's version number and exit
--mode {Mode.minify,Mode.beautify}
Select mode of operation. Minify will prepare files
for deployment, beautify will prepare files for
development.
--format FORMAT Format string used to generate any output filename.
(Dangerous!!)
--overwrite Allow overwrite of existing destination files in-
place. Default is skip and warn. (Dangerous!!)
--on-change Allow overwrite files only on source changed (detected
by modify time).
--verbose Show more output during processing.
--quiet Show no output during processing.
--dry-run Never touch files, only log what would have been done
(for debugging purposes)
--copy Just copy files verbatime without processing them.
--force Overwrite even if destination exists and is newer.
(Dangerous!!)
--diff Log diff output for every file processed (warning:
will be slow and output a lot of log).
--no-size-checks Disable size sanity checks (detects and prevents run-
away processors generating huge amounts of data
--size-max NUM Set maximum size of files to process in bytes.
--size-min NUM Set minimum size of files to process in bytes.
--nproc NUM Set number of cores for multiprocessing (default is
number of cores available which is 24 on this machine)
--gzip Create a GZIP compressed version of every non binary
file processed with .gz suffix added.
--disable-type-svg Copy svg files verbatim instead of processing them for
given handler type
--disable-type-sql Copy sql files verbatim instead of processing them for
given handler type
--disable-type-json Copy json files verbatim instead of processing them
for given handler type
--disable-type-css Copy css files verbatim instead of processing them for
given handler type
--disable-type-png Copy png files verbatim instead of processing them for
given handler type
--disable-type-sass Copy sass files verbatim instead of processing them
for given handler type
--disable-type-html Copy html files verbatim instead of processing them
for given handler type
--disable-type-jinja Copy jinja files verbatim instead of processing them
for given handler type
--disable-type-js Copy js files verbatim instead of processing them for
given handler type
--disable-type-jpeg Copy jpeg files verbatim instead of processing them
for given handler type
--disable-extension-svg
Copy svg files verbatim instead of processing them for
given filename extension
--disable-extension-jinja2
Copy jinja2 files verbatim instead of processing them
for given filename extension
--disable-extension-template
Copy template files verbatim instead of processing
them for given filename extension
--disable-extension-sql
Copy sql files verbatim instead of processing them for
given filename extension
--disable-extension-pgsql
Copy pgsql files verbatim instead of processing them
for given filename extension
--disable-extension-jpg
Copy jpg files verbatim instead of processing them for
given filename extension
--disable-extension-css
Copy css files verbatim instead of processing them for
given filename extension
--disable-extension-json
Copy json files verbatim instead of processing them
for given filename extension
--disable-extension-htm
Copy htm files verbatim instead of processing them for
given filename extension
--disable-extension-png
Copy png files verbatim instead of processing them for
given filename extension
--disable-extension-tpl
Copy tpl files verbatim instead of processing them for
given filename extension
--disable-extension-sass
Copy sass files verbatim instead of processing them
for given filename extension
--disable-extension-html
Copy html files verbatim instead of processing them
for given filename extension
--disable-extension-scss
Copy scss files verbatim instead of processing them
for given filename extension
--disable-extension-j2
Copy j2 files verbatim instead of processing them for
given filename extension
--disable-extension-jinja
Copy jinja files verbatim instead of processing them
for given filename extension
--disable-extension-js
Copy js files verbatim instead of processing them for
given filename extension
--disable-extension-jpeg
Copy jpeg files verbatim instead of processing them
for given filename extension
--output OUTPUT Path to local output (file or folder).
input Path to local input (file or folder).
common:
Options common to many formats
--sort Alphabetically sort CSS Properties (CSS).
--comments Keep comments (CSS/HTML).
--timestamp Add a timestamp in output files (CSS/HTML/SVG).
--wrap Wrap output to ~80 chars per line (CSS).
svg optimization:
Optimization options that are only available for SVG
--set-precision NUM set number of significant digits (default: 5)
--set-c-precision NUM
set number of significant digits for control points
(default: same as '--set-precision')
--disable-simplify-colors
won't convert colors to #RRGGBB format
--disable-style-to-xml
won't convert styles into XML attributes
--disable-group-collapsing
won't collapse <g> elements
--create-groups create <g> elements for runs of elements with
identical attributes
--keep-editor-data won't remove Inkscape, Sodipodi, Adobe Illustrator or
Sketch elements and attributes
--keep-unreferenced-defs
won't remove elements within the defs container that
are unreferenced
--renderer-workaround
work around various renderer bugs (currently only
librsvg) (default)
--no-renderer-workaround
do not work around various renderer bugs (currently
only librsvg)
svg document:
Document options that are only available for SVG
--strip-xml-prolog won't output the XML prolog (<?xml ?>)
--remove-titles remove <title> elements
--remove-descriptions
remove <desc> elements
--remove-metadata remove <metadata> elements (which may contain license
or author information etc.)
--remove-descriptive-elements
remove <title>, <desc> and <metadata> elements
--enable-comment-stripping
remove all comments (<!-- -->)
--disable-embed-rasters
won't embed rasters as base64-encoded data
--enable-viewboxing changes document width / height to 100pct / 100pct and
creates viewbox coordinates
svg output formatting:
Output formatting options that are only available for SVG
--indent TYPE indentation of the output: none, space, tab (default:
space)
--nindent NUM depth of the indentation, i.e. number of spaces /
tabs: (default: 1)
--no-line-breaks do not create line breaks in output(also disables
indentation; might be overridden by
xml:space="preserve")
--strip-xml-space strip the xml:space="preserve" attribute from the root
SVG element
svg id attributes:
ID attribute options that are only available for SVG
--enable-id-stripping
remove all unreferenced IDs
--shorten-ids shorten all IDs to the least number of letters
possible
--shorten-ids-prefix PREFIX
add custom prefix to shortened IDs
--protect-ids-noninkscape
don't remove IDs not ending with a digit
--protect-ids-list LIST
don't remove IDs given in this comma-separated list
--protect-ids-prefix PREFIX
don't remove IDs starting with the given prefix
svg compatability checks:
Compatibility check options that are only available for SVG
--error-on-flowtext exit with error if the input SVG uses non-standard
flowing text (only warn by default)
---------------------------------------------------------
__ _ _ ___
_ _____ / / ______ _ (_)__ (_) _/_ __
| |/|/ / -_) _ \/___/ ' \/ / _ \/ / _/ // /
|__,__/\__/_.__/ /_/_/_/_/_//_/_/_/ \_, /
/___/
v1.1.2
Process all CSS/SASS/HTML/JS/SVG/PNG/JPEG found at input,
either in single file or recursively through a directory.
Will output in place, to specified file or folder depending
on what output was specified.
Will apply transformation to each file according to
selected mode:
Mode = minify (for optimizing production):
+ Compile (SASS -> CSS)
+ Strip whitespace
+ Strip comments
+ Strip metadata
+ Increase compression ratio (PNG, JPEG)
+ Sort (CSS)
+ Add timestamp (CSS, HTML)
+ Obfuscate (CSS, JS)
+ Hash
Mode = beautify (for aiding development):
+ lint (JS, HTML)
+ normalize format (JS, HTML)
Provides some options for processing:
+ Process files in-place
+ Process files renaming to new form
+ Compress results to .gz (all non-binary files)
Available variables in format string are:
+ {EXT}
+ {HASH}
+ {PATH}
+ {BASE}
```
</details>
## Developing web-minify
web-minify is [available on gitlab](https://gitlab.com/octomy/web-minify).
__web-minify welcomes PRs!__ If you want to contribute we welcome your code contriburtions! We are proud of the fact that this project is a true meritocracy.
Example: extending web-minify to support additional formats is done by a very simple interface:
1. Put a module under `web-minify/web_minify/handlers/your_format`. This can either be a module folder or python module source file. See [css/](web_minify/handlers/css) or [html.py](web_minify/handlers/html.py) for example implementations.
2. Include the new function in `__all__` in `web-minify/web_minify/handlers/__init__.py`
3. Register the new function in `self.processor_map` in `web-minify/web_minify/processor.py`
Easy as 🥧!
### Supported formats
Already supported Formats:
| Format | | minify | beautify | Tests |
|----------|-------|--------|----------|-------|
| *.html, *htm, *.tpl | Hypertext Markup Language | ✅ | ✅ | ❌ |
| *.css | Cascading Style Sheets | ✅ | ❌ | ❌ |
| *.js | JavaScript | ✅✝ | ✅ | ❌ |
| *.json | JavaScript Object Notation | ✅ | ✅ | ❌ |
| *.sass | Syntactically Awesome Style Sheets | ✅ | ❌ | ❌ |
| *.scss | Syntactically Awesome Style Sheets (modern syntax) | ✅ | ❌ | ❌ |
| *.png | Portable Network Graphics | ✅ | ❌ | ❌ |
| *.jpg, *.jpeg | Joint Photographic Experts Group | ✅ | ❌ | ❌ |
| *.svg | Scalable Vector Graphics | ✅ | ❌ | ❌ |
| *.sql | Structured Query Language | ❌ | ✅ | ❌ |
| *.your_file | web-minify is made to be [extensible](#Developing-web-minify) | ✅✝✝ | ✅✝✝ | ✅✝✝ |
_✝Buggy for modern syntax features_
_✝✝Submit your PR!_
# License
Complete license is in the file [LICENSE](LICENSE) in the root of the git repo.
> GNU GPL and GNU LGPL or MIT.
> This work is free software: You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This work is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; Without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this work.
# Other Notable Features
1. Supports recursive scanning of directories
2. Supports spitting out .gz versions of files to speed up serving of static files
3. Supports some controls over each format's processing
4. Supports change detection and watch mode
5. Made to be somewhat [extensible](#extending-web-minify)
# Known Limitations and Problems:
1. Compression of modern .js haves some bugs. We welcome PRs!
2. Some of the usage patterns of the command line tool are not implemented yet. We welcome PRs!
3. Codebase has ZERO tests. We welcome PRs!
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/octomy/web-minifier",
"name": "web-minify",
"maintainer": "Lennart Rolland",
"docs_url": null,
"requires_python": ">=3.7.4",
"maintainer_email": "lennart@octomy.org",
"keywords": "python3,CSS,HTML,JS,SVG,PNG,JPEG,Compressor,CSS3,HTML5,Web,Javascript,Minifier,Minify,Uglify,Obfuscator",
"author": "Lennart Rolland",
"author_email": "lennart@octomy.org",
"download_url": "https://files.pythonhosted.org/packages/46/48/f31ada04509aec95c494d1eddb18031c0e52fad89257d12bd9cf38246a67/web-minify-1.1.3.tar.gz",
"platform": "Linux",
"description": "[![pipeline status](https://gitlab.com/octomy/web-minify/badges/production/pipeline.svg)](https://gitlab.com/octomy/web-minify/-/commits/production)\n<!---\n \n \n ## ## ## ## ## ## ## ## ## ## ## \n ## ## ## ## ## ## ## ## ## \n ## ## ## ## ## ## ## \n ## ## ## ## ## \n ## ## ## \n ## \n \n \nWARNING: This file is AUTO GENERATED from \"tpl_README.md\".\n Any changes you make will be OVERWRITTEN at the \n next invocation of `make readme` \n \n \n ## \n ## ## ## \n ## ## ## ## ## \n ## ## ## ## ## ## ## \n ## ## ## ## ## ## ## ## ## \n ## ## ## ## ## ## ## ## ## ## ## \n \n \n-->\n# About web-minify (version 1.1.2-test-development)\n\n<img src=\"https://gitlab.com/octomy/web-minify/-/raw/production/design/logo-1024.png\" width=\"20%\"/>\n\n__web-minify__ is the all-in-one just-works-out-of-the-box does-what-you-want highly-opinionated web minifier™\n\n- web-minify is [available on gitlab](https://gitlab.com/octomy/web-minify).\n\n## Goals of this tool:\n\n> NOTE: We have not reached all these goals yet, please see next sections.\n\n| Goal | Status |\n|--------|-------------|\n| All-in-one compressor/obfuscator/minifier/cruncher for most of the common static web formats | See [list of supported formats](#supported-formats). | \u2705 |\n| Installable via PyPi on platforms supported by Python 3+ | \u2705 |\n| No dependencies on large non-python tool such as nodejs | \u2705 |\n| Support for images formats such as [.png](https://en.wikipedia.org/wiki/Portable_Network_Graphics) and [.jpeg](https://en.wikipedia.org/wiki/JPEG) | \u2705 |\n| Support for vector graphics formats such as [.svg](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) | \u2705 |\n| Support for style sheet formats such as .css and [.sass](https://en.wikipedia.org/wiki/Sass_(stylesheet_language) | \u2705 |\n| Support for script formats such as .js | \u2705 |\n| Support for template formats such as .jinja | \u2705 |\n| Support for markup formats such as .html | \u2705 |\n| Handle intertwined formats such as JS and CSS inside HTML | \u274c |\n| Does what you hoped by default (i.e. highly opinionated) | \u2705 |\n| Can be tweaked to do what you didn't want (i.e. flexible) | \u2705 |\n| Small and dependency free (i.e. implemented in pure python if possible) | Only tested/used on Linux. There is hope for OSX/BSD/Posix but YMMV on Windows. |\n| Available as library as well as command-line tool | \u2705 |\n| Easily extensible; adding another backend can be done by writing one function | \u2705 |\n| Cross platform, supports many Python 3.x versions | Only tested on Python 3.7 |\n\n\n# Getting started\n\n__web-minify__ can be used and hacked on in a myriad of different ways. \n\n## Use web-minify as a module from your code\n\nweb-minify is [available in PyPI](https://pypi.org/project/web-minify/).\n\n```shell\n# Install web-minify into your current Python environment\npip install web-minify\n\n```\n\nNow you can access it's features from your code:\n\n<details>\n\n```Python\nimport web_minify\n\nsettings = {\n \"input\": \"my_originals_dir/\",\n \"output\": \"my_processed_dir/\",\n}\n\n# Instanciate processor with settings we want to use\np = web_minify.processor.Processor(settings)\n\n\n# Process files as per settings (this is equivalent to the commandline mode)\np. process_file()\n\n\n# Process a list of files relative to input, and output them depending on settings\np. process_files_list([\"input_file.svg\", \"input_file.html\"])\n\n\n# Process a single file (disregard input/output from settings\np.process_file(\"some_input_file.svg\", \"some_output_file.svg\")\n\n```\n\n</details>\n\n\n## Use web-minify as a command line tool\n\nweb-minify is [available in PyPI](https://pypi.org/project/web-minify/).\n\n```shell\n# Install web-minify into your current Python environment\npip install web-minify\n\n```\n\n```shell\n# Run the web-minify cli tool with help argument to see detailed usage\nweb-minify --help\n\n```\n\n\nThe output looks like this:\n\n<details>\n\n```shell\n$ ./web-minify.py --help\n\nusage: web-minify.py [-h] [--version] [--mode {Mode.minify,Mode.beautify}]\n [--format FORMAT] [--overwrite] [--on-change] [--verbose]\n [--quiet] [--dry-run] [--copy] [--force] [--diff]\n [--no-size-checks] [--size-max NUM] [--size-min NUM]\n [--nproc NUM] [--gzip] [--disable-type-svg]\n [--disable-type-sql] [--disable-type-json]\n [--disable-type-css] [--disable-type-png]\n [--disable-type-sass] [--disable-type-html]\n [--disable-type-jinja] [--disable-type-js]\n [--disable-type-jpeg] [--disable-extension-svg]\n [--disable-extension-jinja2]\n [--disable-extension-template] [--disable-extension-sql]\n [--disable-extension-pgsql] [--disable-extension-jpg]\n [--disable-extension-css] [--disable-extension-json]\n [--disable-extension-htm] [--disable-extension-png]\n [--disable-extension-tpl] [--disable-extension-sass]\n [--disable-extension-html] [--disable-extension-scss]\n [--disable-extension-j2] [--disable-extension-jinja]\n [--disable-extension-js] [--disable-extension-jpeg]\n [--output OUTPUT] [--sort] [--comments] [--timestamp]\n [--wrap] [--set-precision NUM] [--set-c-precision NUM]\n [--disable-simplify-colors] [--disable-style-to-xml]\n [--disable-group-collapsing] [--create-groups]\n [--keep-editor-data] [--keep-unreferenced-defs]\n [--renderer-workaround] [--no-renderer-workaround]\n [--strip-xml-prolog] [--remove-titles]\n [--remove-descriptions] [--remove-metadata]\n [--remove-descriptive-elements]\n [--enable-comment-stripping] [--disable-embed-rasters]\n [--enable-viewboxing] [--indent TYPE] [--nindent NUM]\n [--no-line-breaks] [--strip-xml-space]\n [--enable-id-stripping] [--shorten-ids]\n [--shorten-ids-prefix PREFIX] [--protect-ids-noninkscape]\n [--protect-ids-list LIST] [--protect-ids-prefix PREFIX]\n [--error-on-flowtext]\n input\n\noptional arguments:\n -h, --help show this help message and exit\n\ngeneral:\n General options for this program\n\n --version show program's version number and exit\n --mode {Mode.minify,Mode.beautify}\n Select mode of operation. Minify will prepare files\n for deployment, beautify will prepare files for\n development.\n --format FORMAT Format string used to generate any output filename.\n (Dangerous!!)\n --overwrite Allow overwrite of existing destination files in-\n place. Default is skip and warn. (Dangerous!!)\n --on-change Allow overwrite files only on source changed (detected\n by modify time).\n --verbose Show more output during processing.\n --quiet Show no output during processing.\n --dry-run Never touch files, only log what would have been done\n (for debugging purposes)\n --copy Just copy files verbatime without processing them.\n --force Overwrite even if destination exists and is newer.\n (Dangerous!!)\n --diff Log diff output for every file processed (warning:\n will be slow and output a lot of log).\n --no-size-checks Disable size sanity checks (detects and prevents run-\n away processors generating huge amounts of data\n --size-max NUM Set maximum size of files to process in bytes.\n --size-min NUM Set minimum size of files to process in bytes.\n --nproc NUM Set number of cores for multiprocessing (default is\n number of cores available which is 24 on this machine)\n --gzip Create a GZIP compressed version of every non binary\n file processed with .gz suffix added.\n --disable-type-svg Copy svg files verbatim instead of processing them for\n given handler type\n --disable-type-sql Copy sql files verbatim instead of processing them for\n given handler type\n --disable-type-json Copy json files verbatim instead of processing them\n for given handler type\n --disable-type-css Copy css files verbatim instead of processing them for\n given handler type\n --disable-type-png Copy png files verbatim instead of processing them for\n given handler type\n --disable-type-sass Copy sass files verbatim instead of processing them\n for given handler type\n --disable-type-html Copy html files verbatim instead of processing them\n for given handler type\n --disable-type-jinja Copy jinja files verbatim instead of processing them\n for given handler type\n --disable-type-js Copy js files verbatim instead of processing them for\n given handler type\n --disable-type-jpeg Copy jpeg files verbatim instead of processing them\n for given handler type\n --disable-extension-svg\n Copy svg files verbatim instead of processing them for\n given filename extension\n --disable-extension-jinja2\n Copy jinja2 files verbatim instead of processing them\n for given filename extension\n --disable-extension-template\n Copy template files verbatim instead of processing\n them for given filename extension\n --disable-extension-sql\n Copy sql files verbatim instead of processing them for\n given filename extension\n --disable-extension-pgsql\n Copy pgsql files verbatim instead of processing them\n for given filename extension\n --disable-extension-jpg\n Copy jpg files verbatim instead of processing them for\n given filename extension\n --disable-extension-css\n Copy css files verbatim instead of processing them for\n given filename extension\n --disable-extension-json\n Copy json files verbatim instead of processing them\n for given filename extension\n --disable-extension-htm\n Copy htm files verbatim instead of processing them for\n given filename extension\n --disable-extension-png\n Copy png files verbatim instead of processing them for\n given filename extension\n --disable-extension-tpl\n Copy tpl files verbatim instead of processing them for\n given filename extension\n --disable-extension-sass\n Copy sass files verbatim instead of processing them\n for given filename extension\n --disable-extension-html\n Copy html files verbatim instead of processing them\n for given filename extension\n --disable-extension-scss\n Copy scss files verbatim instead of processing them\n for given filename extension\n --disable-extension-j2\n Copy j2 files verbatim instead of processing them for\n given filename extension\n --disable-extension-jinja\n Copy jinja files verbatim instead of processing them\n for given filename extension\n --disable-extension-js\n Copy js files verbatim instead of processing them for\n given filename extension\n --disable-extension-jpeg\n Copy jpeg files verbatim instead of processing them\n for given filename extension\n --output OUTPUT Path to local output (file or folder).\n input Path to local input (file or folder).\n\ncommon:\n Options common to many formats\n\n --sort Alphabetically sort CSS Properties (CSS).\n --comments Keep comments (CSS/HTML).\n --timestamp Add a timestamp in output files (CSS/HTML/SVG).\n --wrap Wrap output to ~80 chars per line (CSS).\n\nsvg optimization:\n Optimization options that are only available for SVG\n\n --set-precision NUM set number of significant digits (default: 5)\n --set-c-precision NUM\n set number of significant digits for control points\n (default: same as '--set-precision')\n --disable-simplify-colors\n won't convert colors to #RRGGBB format\n --disable-style-to-xml\n won't convert styles into XML attributes\n --disable-group-collapsing\n won't collapse <g> elements\n --create-groups create <g> elements for runs of elements with\n identical attributes\n --keep-editor-data won't remove Inkscape, Sodipodi, Adobe Illustrator or\n Sketch elements and attributes\n --keep-unreferenced-defs\n won't remove elements within the defs container that\n are unreferenced\n --renderer-workaround\n work around various renderer bugs (currently only\n librsvg) (default)\n --no-renderer-workaround\n do not work around various renderer bugs (currently\n only librsvg)\n\nsvg document:\n Document options that are only available for SVG\n\n --strip-xml-prolog won't output the XML prolog (<?xml ?>)\n --remove-titles remove <title> elements\n --remove-descriptions\n remove <desc> elements\n --remove-metadata remove <metadata> elements (which may contain license\n or author information etc.)\n --remove-descriptive-elements\n remove <title>, <desc> and <metadata> elements\n --enable-comment-stripping\n remove all comments (<!-- -->)\n --disable-embed-rasters\n won't embed rasters as base64-encoded data\n --enable-viewboxing changes document width / height to 100pct / 100pct and\n creates viewbox coordinates\n\nsvg output formatting:\n Output formatting options that are only available for SVG\n\n --indent TYPE indentation of the output: none, space, tab (default:\n space)\n --nindent NUM depth of the indentation, i.e. number of spaces /\n tabs: (default: 1)\n --no-line-breaks do not create line breaks in output(also disables\n indentation; might be overridden by\n xml:space=\"preserve\")\n --strip-xml-space strip the xml:space=\"preserve\" attribute from the root\n SVG element\n\nsvg id attributes:\n ID attribute options that are only available for SVG\n\n --enable-id-stripping\n remove all unreferenced IDs\n --shorten-ids shorten all IDs to the least number of letters\n possible\n --shorten-ids-prefix PREFIX\n add custom prefix to shortened IDs\n --protect-ids-noninkscape\n don't remove IDs not ending with a digit\n --protect-ids-list LIST\n don't remove IDs given in this comma-separated list\n --protect-ids-prefix PREFIX\n don't remove IDs starting with the given prefix\n\nsvg compatability checks:\n Compatibility check options that are only available for SVG\n\n --error-on-flowtext exit with error if the input SVG uses non-standard\n flowing text (only warn by default)\n\n ---------------------------------------------------------\n __ _ _ ___ \n _ _____ / / ______ _ (_)__ (_) _/_ __\n| |/|/ / -_) _ \\/___/ ' \\/ / _ \\/ / _/ // /\n|__,__/\\__/_.__/ /_/_/_/_/_//_/_/_/ \\_, / \n /___/ \nv1.1.2\n\n Process all CSS/SASS/HTML/JS/SVG/PNG/JPEG found at input,\n either in single file or recursively through a directory.\n\n Will output in place, to specified file or folder depending\n on what output was specified.\n\n Will apply transformation to each file according to\n selected mode:\n\n Mode = minify (for optimizing production):\n + Compile (SASS -> CSS)\n + Strip whitespace\n + Strip comments\n + Strip metadata\n + Increase compression ratio (PNG, JPEG)\n + Sort (CSS)\n + Add timestamp (CSS, HTML)\n + Obfuscate (CSS, JS)\n + Hash\n\n Mode = beautify (for aiding development):\n + lint (JS, HTML)\n + normalize format (JS, HTML)\n\n Provides some options for processing:\n + Process files in-place\n + Process files renaming to new form\n + Compress results to .gz (all non-binary files)\n\n Available variables in format string are:\n + {EXT}\n + {HASH}\n + {PATH}\n + {BASE}\n \n\n```\n\n</details>\n\n## Developing web-minify\n\nweb-minify is [available on gitlab](https://gitlab.com/octomy/web-minify).\n\n__web-minify welcomes PRs!__ If you want to contribute we welcome your code contriburtions! We are proud of the fact that this project is a true meritocracy.\n\nExample: extending web-minify to support additional formats is done by a very simple interface:\n\n1. Put a module under `web-minify/web_minify/handlers/your_format`. This can either be a module folder or python module source file. See [css/](web_minify/handlers/css) or [html.py](web_minify/handlers/html.py) for example implementations.\n2. Include the new function in `__all__` in `web-minify/web_minify/handlers/__init__.py`\n3. Register the new function in `self.processor_map` in `web-minify/web_minify/processor.py`\n\nEasy as \ud83e\udd67!\n\n\n### Supported formats\nAlready supported Formats:\n\n\n| Format | | minify | beautify | Tests |\n|----------|-------|--------|----------|-------|\n| *.html, *htm, *.tpl | Hypertext Markup Language | \u2705 | \u2705 | \u274c |\n| *.css | Cascading Style Sheets | \u2705 | \u274c | \u274c |\n| *.js | JavaScript | \u2705\u271d | \u2705 | \u274c |\n| *.json | JavaScript Object Notation | \u2705 | \u2705 | \u274c |\n| *.sass | Syntactically Awesome Style Sheets | \u2705 | \u274c | \u274c |\n| *.scss | Syntactically Awesome Style Sheets (modern syntax) | \u2705 | \u274c | \u274c |\n| *.png | Portable Network Graphics | \u2705 | \u274c | \u274c |\n| *.jpg, *.jpeg | Joint Photographic Experts Group | \u2705 | \u274c | \u274c |\n| *.svg | Scalable Vector Graphics | \u2705 | \u274c | \u274c |\n| *.sql | Structured Query Language | \u274c | \u2705 | \u274c |\n| *.your_file | web-minify is made to be [extensible](#Developing-web-minify) | \u2705\u271d\u271d | \u2705\u271d\u271d | \u2705\u271d\u271d |\n\n_\u271dBuggy for modern syntax features_\n_\u271d\u271dSubmit your PR!_\n\n\n# License\n\nComplete license is in the file [LICENSE](LICENSE) in the root of the git repo.\n\n> GNU GPL and GNU LGPL or MIT.\n> This work is free software: You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This work is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; Without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this work.\n\n\n\n# Other Notable Features\n\n1. Supports recursive scanning of directories\n2. Supports spitting out .gz versions of files to speed up serving of static files\n3. Supports some controls over each format's processing\n4. Supports change detection and watch mode\n5. Made to be somewhat [extensible](#extending-web-minify)\n\n# Known Limitations and Problems:\n\n1. Compression of modern .js haves some bugs. We welcome PRs!\n2. Some of the usage patterns of the command line tool are not implemented yet. We welcome PRs!\n3. Codebase has ZERO tests. We welcome PRs!",
"bugtrack_url": null,
"license": "GPL-3 LGPL-3 MIT",
"summary": "CSS HTML JS SVG PNG JPEG Minifier",
"version": "1.1.3",
"project_urls": {
"Bugs": "https://gitlab.com/octomy/web-minify/-/issues",
"C.I.": "https://gitlab.com/octomy/web-minify/pipelines",
"Docs": "https://gitlab.com/octomy/web-minify/README.md",
"Download": "https://gitlab.com/octomy/web-minify",
"Homepage": "https://gitlab.com/octomy/web-minifier"
},
"split_keywords": [
"python3",
"css",
"html",
"js",
"svg",
"png",
"jpeg",
"compressor",
"css3",
"html5",
"web",
"javascript",
"minifier",
"minify",
"uglify",
"obfuscator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4648f31ada04509aec95c494d1eddb18031c0e52fad89257d12bd9cf38246a67",
"md5": "ab615300535ab68db76d0b549def1f76",
"sha256": "77d00103e4cc55727be12e4137411037a0a003a703fa2190910f393e8a5b0044"
},
"downloads": -1,
"filename": "web-minify-1.1.3.tar.gz",
"has_sig": false,
"md5_digest": "ab615300535ab68db76d0b549def1f76",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.4",
"size": 155897,
"upload_time": "2023-08-31T23:11:06",
"upload_time_iso_8601": "2023-08-31T23:11:06.672816Z",
"url": "https://files.pythonhosted.org/packages/46/48/f31ada04509aec95c494d1eddb18031c0e52fad89257d12bd9cf38246a67/web-minify-1.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-31 23:11:06",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "octomy",
"gitlab_project": "web-minifier",
"lcname": "web-minify"
}