How to use Hogan.js in a separate js file

155 Views Asked by At

This question is from this thread:

Twitter Typeahead.js with Flask Jinja2 Templating

As suggested, I am trying to separate my js file. Here is the code

    $('#search').typeahead({
        name: 'Search',
        local: {
            value: 'String',
            tokens: ['Test1','Test2']
            language: 'English'
        },
        template: {{language}},
        engine: Hogan
    });

I understand what the problem is, but how do I "include" hogan.js? I have installed node.js and I can make it work through that, however, I don't understand how to apply it through flask.

1

There are 1 best solutions below

0
On

If you are including a static file you can use Flask's url_for.

http://flask.pocoo.org/docs/quickstart/#static-files