sveltejs / svelte-cli

Command line interface for Svelte
MIT License
104 stars 18 forks source link

Watch Mode? #21

Open ChrisTalman opened 7 years ago

ChrisTalman commented 7 years ago

Should the CLI include a -watch option? It could be useful during development. It could be similar to watch in TypeScript.

Rich-Harris commented 7 years ago

It could do, yeah. watch modes can get surprisingly complicated — the built-in fs.watch is unreliable on some platforms so you sometimes have to use something like chokidar, which can also be a bit of a pain, and you have to handle all kinds of weird cases like files being renamed, files being created in a watched directory, etc.

So we haven't bothered with that yet because for the most part it's best left to things like webpack and Rollup (with rollup-watch) — they've already solved these problems, and have extra features (like CSS extraction) that are maybe a little harder to do via a CLI.

But it would be a good addition in the longer term. PRs always welcome! 😀

ScottMaclure commented 7 years ago

Yeh I'm using rollup-watch (with rollup-plugin-svelte of course). Single responsibility principle?