skip to navigation
skip to content

rev-assets 1.0.3

Make possible to use hashed static assets generated by tools like Gulp or Webpack


.. image::
:alt: Build Status

You care about the performance of your site, so you've configured the web server to cache all your assets for a long time. The most used way to bypass that cache when deploying a new version, is to add a hash of the assets to their names.
'scripts/home.js' --> 'scripts/home.1a23b.js'
'styles/home.css' --> 'styles/home.aef45.css'

The problem is, now your Python web app can't find the file unless you manually –and painstakingly— update all the URLs in the templates.

.. code:: html+jinja

<script src="{{ url_for('static', filename='scripts/home.js') }}&gt;&lt;/script&gt;&lt;br&gt; &lt;link rel=" stylesheet"="" href="{{ url_for('static', filename='styles/home.css') }}&lt;/script&gt;&lt;br&gt;&lt;br&gt;Whit this library, there is no need for that. Just change your templates to:&lt;br&gt;&lt;br&gt;.. code:: html+jinja&lt;br&gt;&lt;br&gt; &lt;script src=" {{="" 'scripts="" home.js'="" |="" asset_url="" }}=""></script>
File Type Py Version Uploaded on Size
rev-assets-1.0.3.tar.gz (md5) Source 2017-04-25 4KB
rev_assets-1.0.3-py3-none-any.whl (md5) Python Wheel 3.6 2017-04-25 5KB