Please note this file has an .njk extension.
To include arbitrary static resources in this demo, you must declare them in static
property in this pattern's index.md
file. Then you can use them in the demo as static files. E.g.:
// index.md file:
---
...
static:
- special-script.js
- icon.svg
---
// demo.njk file:
<script src="special-script.js">
<img src="icon.svg" alt="...">
To use inline scripts, you need to declare them for CSP policy by using cspHash
filter:
cspHash
and safe
filter
// demo.njk file:
{% set script %}
console.log('Here goes script logic')
{% endset %}
<script>{{ script | minifyJs | cspHash | safe }}</script>