python - Flask-Assets Bundles - Explanation of "ASSET_URL" for minify filters -
i'm implementing flask-assets, , i've read through documentation here:
- https://flask-assets.readthedocs.io/en/latest/
- http://webassets.readthedocs.io/en/latest/bundles.html
- https://github.com/miracle2k/flask-assets/blob/master/docs/index.rst
but i'm still having trouble understanding going on asset_url variable when referencing minified output in template. example, shows here:
{% assets "js_all" %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endassets %} can explain variable first introduced? feel flask-assets / bundle documentation makes lot of assumptions readers' knowledge of these topics , skips on details.
in test, asset_url seems serving original file template, not minified file. part of have:
application = flask(__name__, static_url_path='', static_folder='static') application.config["assets_debug"] = true bundles = { 'index_js': bundle( 'js/index.js', output='js/index-min.js', filters='jsmin'), } assets = environment(application) assets.register(bundles) ...and in template:
{% assets "index_js" %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endassets %} ...but src served original file.
edit:
i realized "assets_debug" set true causes no minification occur. documentation makes seem not merge sources output, doesn't have effect.
however, helpful have more explanation concerning logic behind asset_url. can't seem track logic @ repo here.
Comments
Post a Comment