[英]How to integrate an external javascript file into PugJS?
I'm trying to make a web application using Node.js and Express and PugJS as a template engine. 我正在尝试使用Node.js和Express和PugJS作为模板引擎来制作Web应用程序。
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. 我的问题:我使用的是Google Maps API,我想将所有Google Maps API函数编码为一个单独的javascript文件。 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. 我不知道如何在pugJS页面中呈现此外部javascript文件以及如何从外部js文件调用函数。
Thats pretty easy; 那很简单; you should use the tag script
, like follows; 您应该使用标记script
,如下所示;
// jquery as an example, include your own script
script(src='/assets/plugins/jquery/jquery.min.js')
script.
// call your functions here
$(function () {
alert('hey')
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.