# Custom JS for ui-template in Dashboard 2.0

**URL:** https://discourse.nodered.org/t/custom-js-for-ui-template-in-dashboard-2-0/85852
**Category:** Dashboard
**Tags:** dashboard-2
**Created:** [24 February 2024 11:53 UTC](https://discourse.nodered.org/t/custom-js-for-ui-template-in-dashboard-2-0/85852 "2024-02-24T11:53:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Stwissel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stwissel/32/126_2.png) [@Stwissel](https://discourse.nodered.org/u/Stwissel)
#### Post date: [24 February 2024 11:53 UTC](https://discourse.nodered.org/t/custom-js-for-ui-template-in-dashboard-2-0/85852/1 "2024-02-24T11:53:19Z")

</div>

The [documentation](https://dashboard.flowfuse.com/nodes/widgets/ui-template.html) of ui template has an example of external JS:

```html
<script src="https://cdn.babylonjs.com/babylon.js"></script>

```

I would like to include a local file resource, so I modified `settings.js` to include

```js
module.exports = {
  httpStatic: '/opt/robotapp/static/',
  httpStaticRoot: '/static/',
}

```

Then I can use:

```html
<script src="/static/test.js"></script>

```

Two questions:

- Is this the right approach or is there a better way?
- When using ES6 syntax I need to use `type=module` in the script tag?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [25 March 2024 11:53 UTC](https://discourse.nodered.org/t/custom-js-for-ui-template-in-dashboard-2-0/85852/2 "2024-03-25T11:53:23Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
