diff options
| author | Adrien CLERC <adrien@antipoul.fr> | 2019-09-02 22:16:08 +0200 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2019-09-03 10:42:51 +0200 |
| commit | 4a7c9d541db3bdbab455d824e33082a2600a8d06 (patch) | |
| tree | cd8c8f9d649fcd6d83368e007595cec64e3ee05b /Makefile | |
| parent | 604f4696d80ecf4cb135cb0af134cd0c198252f4 (diff) | |
| download | ihatemoney-mirror-4a7c9d541db3bdbab455d824e33082a2600a8d06.zip ihatemoney-mirror-4a7c9d541db3bdbab455d824e33082a2600a8d06.tar.gz ihatemoney-mirror-4a7c9d541db3bdbab455d824e33082a2600a8d06.tar.bz2 | |
add compress_assets target to compress PNG.
It depends on zopflipng, find and xargs.
Only zopflipng is tested, since it is the less common.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -6,6 +6,7 @@ DEV_STAMP = $(VENV)/.dev_env_installed.stamp DOC_STAMP = $(VENV)/.doc_env_installed.stamp INSTALL_STAMP = $(VENV)/.install.stamp TEMPDIR := $(shell mktemp -d) +ZOPFLIPNG := zopflipng .PHONY: all all: install ## Alias for install @@ -47,6 +48,15 @@ test: $(DEV_STAMP) ## Run the tests release: $(DEV_STAMP) ## Release a new version (see https://ihatemoney.readthedocs.io/en/latest/contributing.html#how-to-release) $(VENV)/bin/fullrelease +.PHONY: compress_assets +compress_assets: ## Compress static assets + @which $(ZOPFLIPNG) >/dev/null || (echo "ZopfliPNG ($(ZOPFLIPNG)) is missing" && exit 1) + mkdir $(TEMPDIR)/zopfli + $(eval CPUCOUNT := $(shell python -c "import psutil; print(psutil.cpu_count(logical=False))")) +# We need to go into the directory to use an absolute path as a prefix + cd ihatemoney/static/images/; find -name '*.png' -printf '%f\0' | xargs --null --max-args=1 --max-procs=$(CPUCOUNT) $(ZOPFLIPNG) --iterations=500 --filters=01234mepb --lossy_8bit --lossy_transparent --prefix=$(TEMPDIR)/zopfli/ + mv $(TEMPDIR)/zopfli/* ihatemoney/static/images/ + .PHONY: build-translations build-translations: ## Build the translations $(VENV)/bin/pybabel compile -d ihatemoney/translations |
