script.pug
– Powerful script
macros ¶
View source code on GithubLoad external scripts¶
mixin script(src)
script(src=`${src}`
type="text/javascript"
charset="utf-8")&attributes(attributes)
-
+script
(src)¶ Insert an external script avoiding to specify
type
andcharset
HTML attributes.Arguments: - src (string) – External script src.
Usage¶
Input
+script("path/to/file.js")(async defer)
Output
<script src="path/to/file.js" type="text/javascript" charset="UTF-8" async defer>