3 ms·
The main advantage of doing it in the browser is for the developer: you don't need the explicit compile step: just write code, save it, refresh the browser. It
by tlrobinson 18y ago
The main advantage of doing it in the browser is for the developer: you don't need the explicit compile step: just write code, save it, refresh the browser. It also enables neat things like a REPL.
That said, the nice thing about writing the preprocessor in JavaScript was we can do preprocessing ahead of time on the server, if we need to. However, doing it client-side is not as slow as you would expect.
edit: Ross beat me to it, but we said basically the same thing
- maximilian 18y agoIt also seems that you can easily have a "testing mode" where you run the preprocessing client side when you are just building the app, and then when you deploy like "for real", run the preprocessing server side to keep things fast(er). If the site gets too hammered, then you could even have it switch, where an overloaded server tells clients to preprocess for themselves while the server catches up. This would be an interesting way to handle spikes in usage (like now for example)
- tlrobinson 18y agoPresumably the code doesn't change very often, so we actually just preprocess it once per revision and serve up the static files, so there's no extra load on the server or the client.