How to run scripts with PugJS

There are two main methods I use to run scripts from a PugJS template, a front-end method and a back-end method.

Front-end method

This script will be processed on the front-end by the visitors browser.

script.
    console.log("Hello World!")Code language: JavaScript (javascript)

Back-end method

This script will be processed on the backend, a console log will return in the application terminal.

- var count = 0
- console.log(count)Code language: JavaScript (javascript)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.