You can create a fresh
elm-pages project with the
npx elm-pages init my-projectcd my-projectnpm installnpx elm-pages dev
This creates a new project in
my-project/ and starts the dev server. You can then add new routes using the CLI commands below.
elm-pages Scripts can run with the Elm compiler if the Lamdera compiler isn't installed. However, builds (
elm-pages build) and and the dev server (
elm-pages dev) require the Lamdera compiler to be installed.
elm-pages Routes use the lamdera compiler, which is a superset of the Elm compiler with some extra functionality to automatically serialize Elm types to Bytes.
Sometimes Lamdera will give compiler errors due to corrupted dependency cache. These messages will display a note at the bottom:
-- PROBLEM BUILDING DEPENDENCIES ---------------...Note: Sometimes `lamdera reset` can fix this problem by rebuilding caches, sogive that a try first.
Be sure to use
lamdera reset to reset the caches for these cases. See more info about that in the Lamdera docs: https://dashboard.lamdera.app/docs/ides-and-tooling#problem-corrupt-caches
elm-pages dev- Start the
elm-pages run AddRoute Slide.Number_Generate scaffolding for a new Page Module (learn about running scripts and modifying the scaffolding script in the Scaffolding section)
elm-pages build- generate a full production build in the
dist/folder. You'll often want to use a CDN service like Netlify or Vercel to deploy these generated static files
elm-pages dev gives you a dev server with hot module replacement built in. It even reloads your
BackendTasks any time you change them.