The map

Every Puzzle app has the same shape, and this is it: the files puzzle init just wrote. Click through them in the file tree. Only views/Home.pzl is yours to edit in this lesson; the lock marks the rest.

  • app/app.js creates the app and mounts it on the page.
  • app/routes.js maps each URL to a view.
  • app/layouts/ holds the chrome that wraps your pages. Default.pzl draws the header and footer.
  • app/views/ holds the pages themselves. Home.pzl is /, and NotFound.pzl catches everything else.
  • app/components/ holds the pieces pages are built from, like the Counter.
  • app/public/ is served as it is. index.html is the shell the app mounts into.
  • app/styles/ and app/assets/ hold the stylesheet and the icons a template inlines.
  • puzzle.config.js configures the build. The scaffold turns Tailwind on.

Chapter 4 adds app/models/ beside them.

Your turn

  1. Open app/views/Home.pzl.
  2. Find heading in data() and change 'Welcome to Puzzle' to 'Music'. The preview updates as you type.

Chapters