The purpose of this gist is to show how Sanic can be used as a development server for a frontend JS framework. In this example we are running a Svelte app with rollup
, but the same idea could be applied to any other frameworks JS build tools.
Run with:
sanic path.to:app -d -R ./path/to/public
DISCLOSURE: As of 2021-11-09, the
app.config.get("RELOADED_FILES")
is not available yet in released ormain
branch. It is still POC. To obtain this functionality in current Sanic, see what I did here to get livereload working: https://github.com/ahopkins/pywebconf2021-making-sanic-even-faster/blob/main/server.pySomething like this: