Skip to main content

The Ultimate Minimizer For Lua: minimize your lua scripts

Project description

Tumfl: The Ultimate Minimizer For Lua

codecov Code style: black

This package contains the best minimizer you'll find on the market, or so I hope.

Executable

Compile a source file into a destination file, resolving all requires. Optionally recompiles every time the source files change (using -f). Optionally replaces placeholders (using -c).

Placeholders

Using a lua config file like

parameter = "value"
numbered_parameter = 3.14
table_parameter = {foo = 1, "bar"}

it can replace placeholders like

foo("$$parameter")
bar = "$$numbered_parameter"
baz = "$$table_parameter"

by compiling using tumfl source.lua -c config.lua with

foo("value")
bar = 3.14
baz = {foo = 1, "bar"}

The prefix is configurable via --config-prefix

usage: tumfl [-h] [-d DESTINATION] [-v] [-f] [-c CONFIG_FILE] [--config-prefix CONFIG_PREFIX] source_file

Compile lua files

positional arguments:
  source_file           Source file to compile

options:
  -h, --help            show this help message and exit
  -d DESTINATION, --destination DESTINATION
                        Destination file
  -v, --verbose         Be verbose
  -f, --follow          Follow file changes
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        Replace placeholders using config file. Config file is a normal lua file, with top level assignments of
                        `name = value`, not limited to strings. To use an replacement, just use a string int the target file like
                        `"$$name"` (if `$$` is your prefix, and `name` the name to look up).
  --config-prefix CONFIG_PREFIX
                        Prefix for names to be replaced by config values (default: $$)
  -m, --minify          Minify the output

Current status

Parser

  • On par with Lua
  • No support for arbitrary byte strings (only valid UTF-8)

Formatter

  • Highly configurable formatter
  • Can produce both minified and prettyfied results
  • Minified results have minimal amount of characters (only required semicolons, etc.)
  • Lossy in the sense that it does not preserve (all) comments

Minifier

[!CAUTION] The minifier is very experimental, and may change the semantics of your program. Use at your own risk. If it breaks, please open an issue.

  • Minifies Names (normal variables)
  • Creates aliases (i.e. when table is used often, creates a=table and uses a instead of table)

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

tumfl-0.3.14.tar.gz (58.8 kB view details)

Uploaded Source

Built Distribution

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

tumfl-0.3.14-py3-none-any.whl (66.9 kB view details)

Uploaded Python 3

File details

Details for the file tumfl-0.3.14.tar.gz.

File metadata

  • Download URL: tumfl-0.3.14.tar.gz
  • Upload date:
  • Size: 58.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for tumfl-0.3.14.tar.gz
Algorithm Hash digest
SHA256 7a2fe39792b91e2771c1a87a45cd347fd9a19146c45e5e2160400f3a2efe021f
MD5 35fceb7e260e798d37d8616bfe390691
BLAKE2b-256 f94a2ef989e173d96f535793d8646d37b2dc803d3de67596ddd2eb53865a0bdb

See more details on using hashes here.

File details

Details for the file tumfl-0.3.14-py3-none-any.whl.

File metadata

  • Download URL: tumfl-0.3.14-py3-none-any.whl
  • Upload date:
  • Size: 66.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for tumfl-0.3.14-py3-none-any.whl
Algorithm Hash digest
SHA256 df742280cbfccc9734cdcf6bcca0970398c93c06588535e1d60f4c35f3c6fbbe
MD5 bdd8d348f8d210b3fb0c06f51ead5239
BLAKE2b-256 975b819cce35f5ce6fbb67dcdc843b1ff31f94bdab916b6d911fd0271a82f412

See more details on using hashes here.

Supported by

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