How to integrate an external javascript file into PugJS?

545 Views Asked by At

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

There are 1 best solutions below

0
Renato Gama On

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')
    })