jaysonsantos / jinja-assets-compressor

A Jinja extension (compatible with Flask and other frameworks) to compile and/or compress your assets.
Other
93 stars 10 forks source link

use cache folder to only compress changed files #75

Closed alanhamlett closed 4 years ago

alanhamlett commented 4 years ago

When using offline compression and the compressor_cache_dir config is set to the old asset output folder, we can greatly speed up offline compression by copying files that have not changed into output folder instead of re-compiling them. For ex:

Before

time python -m jac.contrib.flask test:app
Deleting previously compressed files in /Users/alan/projects/test/test/static/sdist
Compressing static assets into /Users/alan/projects/test/test/static/sdist
Finished offline-compressing static assets.
real    1m37.951s
user    1m38.567s
sys 0m13.137s

After

time python -m jac.contrib.flask test:app
Deleting previously compressed files in /Users/alan/projects/test/test/static/sdist
Compressing static assets into /Users/alan/projects/test/test/static/sdist
Finished offline-compressing static assets.
real    0m5.676s
user    0m5.951s
sys 0m2.161s

Time saved: 1m32s


This change is Reviewable

alanhamlett commented 4 years ago

Tests failing on ci because of pytest version dependency issue:

pkg_resources.ContextualVersionConflict: (pluggy 1.0.0.dev0 (/tmp/pip-install-sag81lfx/flake8-single-quotes/.eggs/pluggy-1.0.0.dev0-py3.4.egg), Requirement.parse('pluggy<1.0,>=0.12'), {'pytest'})
jaysonsantos commented 4 years ago

Hey there @alanhamlett thanks for your PR! I've just rebased this one to see how the update of pytest goes and then I guess you could rebase your branch as soon as I merge it. https://github.com/jaysonsantos/jinja-assets-compressor/pull/74

alanhamlett commented 4 years ago

Rebased, but build fails after tests because it can't run make lint.

jaysonsantos commented 4 years ago

Hey there, can you run isort on jac/base.py? It is failing because of this jac/base.py:7:1: I001 isort found an import in the wrong position

jaysonsantos commented 4 years ago

Thank you again!

alanhamlett commented 4 years ago

Awesome, thank you! When will the next version hit pypi?

jaysonsantos commented 4 years ago

I can cut a release now