Developing a site
sanoma serves the app and the sites from Vite’s dev server instead of a build (serving the app with 1 site (hello) from Vite's dev server: edits show as they are saved), behind the same login, and writes no build:
- An edit to a site’s file shows in the open page as it is saved, without a reload, the page’s state kept (hot module replacement); the server’s render of the page follows on the next request.
- A file saved under
content/shows on the next render of a page that reads it, drafts included, with no restart, and.sanoma/content.tsis written again. - A new page, or a new site folder, is live once its first route file is written: the route tree is regenerated and open pages reload, with no restart. A Tailwind class in a new file is styled too, by the app’s stylesheet and by a site’s own (
sanoma/app’s A site’s own stylesheet). - A change to
sites/__virtual.tsitself needs a restart: the route generator loads that file once.sanomawrites it; never edit it. sanoma checkbeside it builds the app with the same route options, so it leaves the dev server’s route tree alone.- The dev server listens on this machine only: with
SANOMA_APP_HOSTnaming another,sanomabuilds the sites and serves the build, assanoma appdoes. - A public site (
defineSite({ public: true })) answers at the root of<name>.localhoston the app’s port, with hot updates too, as its visitors see it (public sites);sanoma,sanoma serveandsanoma appprint each one’s address after they start (www: http://www.localhost:3000). Browsers send*.localhostto this machine with no setup.
These pages describe sanoma 0.11.24.