14 ms·
The ./Playground project in the repo does that (taking ST source from a HTML text area). But you could modify it to open a file. (Note that browsers cannot read
by Smalltalker-80 1y ago
The ./Playground project in the repo does that (taking ST source from a HTML text area). But you could modify it to open a file. (Note that browsers cannot read arbitrary files without user interaction.)
The Playground has a slightly modified version of the compiler built in to make this possible.
- em-bee 1y agoi don't mean opening files from disk, but fetching them from the server. i build my site as usual, but instead of converting to js in a build step, i upload the st files to the server. the html in the browser then loads the compiler and fetches the st files from the server, passes them to the compiler and runs them
- Smalltalker-80 1y agoI see. Then you would first have to have (make) a server that serves up *.st source files throug a REST api. Then you would modify the ./Playground project to fetch the files from your server in stead of from the TextArea. This is done in the PlaygroundApp.evaluate method.
- em-bee 1y agowould it have to be a REST API? couldn't i just fetch them as plan text?
- Smalltalker-80 1y agoSure, you could do that too in SmallJS. See the classes in ./Smalltalk/Core/Fetch and in ./Smalltalk/Node/Server. The Fetch unit tests actually have a case for this, I think.