3 ms·
Absolutely! In the repo I included a video where I do exactly that - you can either run a local live server that keeps the output html up to date, or you can d
by jasonjmcghee 2y ago
Absolutely!
In the repo I included a video where I do exactly that - you can either run a local live server that keeps the output html up to date, or you can do a one-off conversion (a command for each).
To import a whole script / library, you can either include it in `scripts` in the configuration at the top, or use a script tag like `<script src="mylib.js"></script>` or similar.
To import specific things from a script with exports you just:
```javascript
// @run type="module"
import { foo } from "./foo.js";
console.log(foo);
```
The @run comment accepts any number of attributes after `// @run` which will be set on the script node.
or you can always eject and use inline html if needed.
<script type="module">
import { foo } from "./foo.js";
console.log(foo);
</script>
The drawback is markdown editors, previews, etc. tend to play much more nicely with markdown code blocks.
If you decide (or need to) use `type="module"` each script / block is isolated apart from `window`.
- rustystump 2y agoawesome thanks!