UNPKG

1.41 kBMarkdownView Raw
1# Dependency file
2
3You can specify extra dependencies for the module `my-module.js` by adding a file `my-module.dep` in the same directory.
4This file must be written in permissive JSON. Here is an example:
5
6```js
7{
8 res: [explosion.mp3, bonus.mp3, victory.avi]
9 js: { unity.min.js: libs/unity.js}
10 var: {
11 vert: "world.vert",
12 frag: "world.frag"
13 }
14}
15```
16
17## res
18
19Most of the time, if you need additional resources for module `my-module`, you can simply put them into `my-module/` directory. The directory content will be copied into `www/css/my-module/`.
20
21But if you want to put resources in another directory, you can use the `res` attribute.
22For instance, `[explosion.mp3]` (or `"explosion.mp3"`) means the compiler will copy `src/mod/explosion.mp3` to `www/explosion.mp3`. Moreover, `{ "explosion.mp3": "assets/explo.mp3" }` means the compiler will copy `src/mod/explosion.mp3` to `www/assets/explo.mp3`.
23
24## js
25
26You may need use of an external library.
27Then the value `{ "unity.min.js": "libs/unity.js" }` means that the compiler must copy `src/mod/unity.min.js` to `www/libs/unity.js`.
28
29## var
30
31Add attributes in the `GLOBAL` variable of your module. The value of such variables is read from a file at compilation time.
32
33In the example above, we will get the code for a vertex shader in `GLOBAL.vert` provided there is a file `world.vert` in the same directory as your module file.