Categories
JavaScript Answers

How to render inline JavaScript with Jade or Pug?

Spread the love

Sometimes, we want to render inline JavaScript with Jade or Pug.

In this article, we’ll look at how to render inline JavaScript with Jade or Pug.

How to render inline JavaScript with Jade or Pug?

To render inline JavaScript with Jade or Pug, we can use script.

For instance, we write

script.
  if (usingJade)
    console.log('awesome')
  else
    console.log('use jade')

will be compiled to

<script>
  if (usingJade)
    console.log('awesome')
  else
    console.log('use jade')
</script>

Conclusion

To render inline JavaScript with Jade or Pug, we can use script.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *