milesfrain / halogen

Template and Tooling for purescript-halogen v5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

See the Official Halogen Template, which is more up to date and now incorporates much of this repo's content.

Quick Start

git clone https://github.com/purescript-templates/halogen.git myApp
cd myApp
npm install -g purescript spago parcel
npm run build
npm run serve

Introduction

This template for purescript-halogen v5 mimics the introductory example of the official React Hooks documentation.

Additional documentation for halogen can be found here:

Pursuit docs are not published yet, but you can build documentation locally with spago docs then open generated-docs/html/index.html.

More examples are available in the package repository.

If you notice any problems with the below setup instructions, or have suggestions on how to make the new-user experience any smoother, please create an issue or pull-request.

Compatible with PureScript compiler 13.6

Initial Setup

Install tools globally:

npm install -g purescript spago parcel

Initial compilation:

npm run build

Launch webapp:

npm run serve

Development Cycle

If you're using an editor that supports purs ide or are running pscid, you simply need to keep the previous npm run serve command running in a terminal. Any save to a file will trigger an incremental recompilation, rebundle, and web page refresh, so you can immediately see your changes.

If your workflow does not support automatic recompilation, or if you add, remove, or modify module names, then you will need to manually re-run npm run build.

Production

When you are ready to create a minified bundle for deployment, run the following command:

npm run build-prod

Parcel output appears in the ./dist/ directory.

You can test the production output locally with a tool like http-server. It seems that parcel should also be able to accomplish this, but it unfortunately will only serve development builds locally.

npm install -g http-server
http-server dist -o

If everything looks good, you can then upload the contents of dist to your preferred static hosting service.

Local Versioned Toolchain

If you'd prefer to install tools on a per-project basis (rather than globally) see this guide.

About

Template and Tooling for purescript-halogen v5


Languages

Language:Dhall 71.8%Language:PureScript 24.1%Language:HTML 3.3%Language:JavaScript 0.8%