miracle2k / flask-assets

Flask webassets integration.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HowTo access flask_assets.Bundle.urls from yaml?

ramschmaerchen opened this issue · comments

How do I access Bundle.urls when using from_yaml?

The following works but I can not access urls when registered via a yaml file.

registered in code works:

test = Bundle('scss/test.scss', filters="pyscss", output='compiled/test.css')
assets.register("test", test)
print(test.urls())
# Output
/static/compiled/test.css?68b329da

registered in yaml does not:

test:
    filters: pyscss
    output: compiled/test.css
    contents:
        - scss/test.scss
assets.from_yaml("static/assets.yaml")
print(test.urls())
# Output
NameError: name 'test' is not defined

You will need to do something like assets['test'].urls()