flask-assets icon indicating copy to clipboard operation
flask-assets copied to clipboard

alternative way to render asset url in templates

Open xiaotian opened this issue 9 years ago • 2 comments

the standard way of render url takes 3 lines

{% assets 'main_css' %}
    <link rel="stylesheet" href="{{ASSET_URL}}">
{% endassets %}

This seems to be a bit verbose I am wondering if it's possible to provide helper function in template like this:

<link rel="stylesheet" href="{{asset_url('main_css')}}">

xiaotian avatar Dec 10 '14 07:12 xiaotian

It isn't, because the template helper needs to be able to update multiple urls. The only thing that would be possible is:

 <head>
  {{asset('main_css')}}
</head>

miracle2k avatar Dec 10 '14 11:12 miracle2k

This is only because of the debug mode, right?

luckydonald avatar Jan 22 '17 03:01 luckydonald