This is a template for starting a fresh project with the Halogen library for writing declarative, type-safe user interfaces.
You can learn more about Halogen with these resources:
- The Halogen documentation, which includes a quick start guide and a concepts reference.
- The Learn Halogen learning repository.
- The Real World Halogen application and guide.
- The API documentation on Pursuit
You can chat with other Halogen users on the PureScript Discourse, or join the Functional Programming Slack (invite link) in the #purescript and #purescript-beginners channels.
Prerequisites: This template assumes you already have Git and Node.js installed with npm somewhere on your path.
First, clone the repository and step into it:
git clone https://github.com/purescript-halogen/purescript-halogen-template.git halogen-project
cd halogen-projectThen, install the PureScript compiler, the Spago package manager and build tool, and Webpack bundler locally:
npm installThis will automatically trigger Spago to install the PureScript library dependencies for this project.
You can now build the PureScript source code with:
# An alias for `spago build`
npm run buildYou can produce a bundled JS file you can run in the browser with:
# An alias for `spago bundle-app --to dist/app.js`
npm run bundleThis deposits a bundled JS file named app.js in the dist directory. You can view your running Halogen app by opening the dist/index.html file.
Alternatively, if you use an editor that supports purs ide or if you are running pscid, then you can get near-instant builds of the app while you work:
npm run bundle:watchpurs ide only rebuilds one module at a time, so sometimes the bundle will end up in an inconsistent state, resulting in runtime errors. This occurs when a change is made in one module that breaks other modules that depend on it. The solution is to run a full build when a change like this is made, as the compiler will force you to resolve those errors.