-
OK thanks. I am actually using npm library from the console. Pretty powerful. So, if there's only one file I think the best option is to bundle the files and minify into a single file. Actually it's a good idea to have a single file. You can do many optimisations using Grunt and that kind of bundlers.
Thanks I just wanted to make sure that it is the only way. Now I'm more clear on what I'm going to do. Cheers.
-
I have been working with Arduino and MicroPython for a while and just switched to Espruino and nodejs on ESP8266. I am able to upload a file and connect to wifi and do lots of stuff. But there's one thing I cannot figure out:
MicroPython had a file structure like below:
- boot.py
- main.py
- mylibrary.py
as the name suggests boot.py is executed on boot, and main.py is the main file where you want to create your main loop. I can create another library and import it from main.py. Arduino also has similar structure. How can I do this in Espruino? Can I upload multiple files? If so how?
- boot.py
Thanks for the answers. So, if bundling not needed that means I need to upload the file which is the starting point of my app. Like
index.js
orapp.js
in a single page app. As Irequire
files espruino will pack them all together and as I understand.I don't use the IDE. I use normal text editor and then use command line like below. Works good.
One thing I don't understand is what happens when I upload another file? It does not seem to overwrite the existing program. For example; I first uploaded
led.js
which just turns on the builtin LED.Then I wrote another program which is client.js and does completely something different:
What I expect; when I upload the second program, the first one will be overwritten therefore LED would turn off. But it doesn't. It seems it ignores the second program. I need to re-flash the firmware if I want to change the program inside.