Closed Gerbaum closed 2 years ago
You can self-host the turbo.js library, and then pass the url
parameter when you call {{ turbo(url='...') }}
to initialize. See https://turbo-flask.readthedocs.io/en/latest/api.html#turbo_flask.Turbo.
Thanks for your help!
I tried to find any compiled version of turbo.js but couldn't find one. Doku of hotwired/turbo page says there should be one in the github directories, but I could find only the source code. And I was unable to compile the source code till now...
The Ruby on Rails package for turbo has the turbo.js and turbo.min.js files: https://github.com/hotwired/turbo-rails/tree/main/app/assets/javascripts.
A better option might be to install @hotwired/turbo
on your computer with npm on a throwaway directory, and then fish out the js file from there.
Hi, so I have tried this approach to get the local version hosted, but the url_for is not being resolved (if I understand correctly)
Where I am defining turbo with the URL as follows:
Any ideas?
Hardcoding the static url works:
{{ turbo(url="/static/javascript/turbo.js }}
I think the issue is not with the library, but rather with the way that there is a nested variable ie.{{ turbo({{ nested replace variable }}) }}
Try it without the inner {{
- you already established it's Jinja code by first `{{, so you can use your variable inside without it.
Yes, that's the problem. Use:
{{ turbo(url=url_for('static', filename='javascript/turbo.js')) }}
Thanks @miguelgrinberg appreciate the help!
I am probably doing something with my setup, but the following didn't return errors:
{{ turbo(url=url_for('static', filename='javascript/turbo.js')) }}
I had an error on trying to build the route for url_for('javascript/turbo.js')
@reghardtp the mistake is mine, your version is the correct one.
Hi, I try to integrate turbo in our intranet without internet connection. That's why our browser gives an error cause it is not possible to navigate to cdn.skypack.dev required by hotwired/turbo
Any idea how I can manage to integrate turbo-flask locally on our server?
Thx for your work!