Skip to content

Commit 908196d

Browse files
committed
docs: links to JavaScript bundling examples.
1 parent 3b22e92 commit 908196d

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ To begin, check out the [Getting started](getting_started.md) guide. See the _Co
3838
- [Failure simulation](./failure_simulation.md)
3939
- [Generating fake data](fake_data.md)
4040
- [CORS](cors.md)
41+
- [JavaScript scripting tips](javascript_tips.md)
4142
- [Groovy scripting tips](groovy_tips.md)
4243
- [JavaScript compatibility](scripting_modern_js.md)
4344
- [Examples](https://github.com/outofcoffee/imposter/tree/main/examples)

docs/javascript_tips.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# JavaScript tips and tricks
2+
3+
## Background
4+
5+
This section provides additional tips and tricks when using JavaScript as the scripting language for your mocks. It builds on the [Scripting](./scripting.md) documentation. If you are new to Imposter scripting, it's best to start there.
6+
7+
## Multi-file JavaScript scripts
8+
9+
Sometimes you may want to split your JavaScript scripts into multiple files for better organisation. You can do this by using a bundler like Webpack or Browserify to bundle your scripts into a single file.
10+
11+
See [imposter-js-types](https://github.com/imposter-project/imposter-js-types) for how to do this.
12+
13+
Check out the [samples](https://github.com/imposter-project/imposter-js-types/tree/main/samples) directory for a JavaScript and a TypeScript example project.
14+

docs/scripting.md

+1
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ respond().withFile('static-data.json')
300300

301301
## Further reading
302302

303+
* [Tips and tricks for JavaScript scripts](./javascript_tips.md)
303304
* [Tips and tricks for Groovy scripts](./groovy_tips.md)
304305
* [Debugging Groovy scripts](./groovy_debugging.md)
305306
* [Using modern JavaScript in scripts](./scripting_modern_js.md)

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ nav:
5353
- Failure simulation: 'failure_simulation.md'
5454
- Generating fake data: 'fake_data.md'
5555
- CORS: 'cors.md'
56+
- JavaScript scripting tips: 'javascript_tips.md'
5657
- Groovy scripting tips: 'groovy_tips.md'
5758
- JavaScript compatibility: 'scripting_modern_js.md'
5859
- Examples: 'https://github.com/outofcoffee/imposter/tree/main/examples'

0 commit comments

Comments
 (0)