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.

Sam T
  • 31
  • 1
  • 2

1 Answers1

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')
    })
Renato Gama
  • 16,431
  • 12
  • 58
  • 92