1

I'm trying to make a web application using Node.js and Express and PugJS as a template engine.

My problem: I'm using a google maps API and I want to code all my google maps API functions into a separate javascript file. I can't figure out how to render this external javascript file in the pugJS page and call to functions from the external js file.

1 Answer 1

2

Thats pretty easy; you should use the tag script, like follows;

// jquery as an example, include your own script
script(src='/assets/plugins/jquery/jquery.min.js')
script.
    // call your functions here
    $(function () {
        alert('hey')
    })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.