Showing posts with label PUG. Show all posts
Showing posts with label PUG. Show all posts

Friday, January 28, 2022

Multiline Javascript with PUG Templates - Mismatched Bracket Error

I came across a straight-forward problem with no apparent solution.  Once I finally fixed it, I wanted to show everyone the solution I found.  Maybe there is a better way?

If you are writing pug temples with multiline javascript, you might get this error:

SyntaxError: Mismatched Bracket: }

That's unfriendly!

(10 minutes later)... I finally figured out the fix was to add a period after the script tag, like this:

script(type="text/javascript").
var recorder = document.getElementById("recorder");
var player = document.getElementById("player");


(See the period after the script close paren?)