• Stars
    star
    343
  • Rank 123,371 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Elm 0.19.1, Webpack 5 & Tailwind

Elm 0.19.1 with Webpack 5, Hot Reloading & Tailwind

CircleCI

Elm dev environment with hot-loading (i.e. state is retained as you edit your code - Hot Module Reloading, HMR)). I use this daily for my professional work. Like elm-community/elm-webpack-starter but using Webpack 4.

Installation

Clone this repo into a new project folder and run install script. (You will probably want to delete the .git/ directory and start version control afresh.)

With npm

$ git clone [email protected]:simonh1000/elm-webpack-starter.git new-project
$ cd new-project
$ npm install

Notes

Developing

Start with Elm debug tool with either

$ npm start
or
$ npm start --nodebug

the --nodebug removes the Elm debug tool. This can become valuable when your model becomes very large.

Open http://localhost:3000 and start modifying the code in /src. Note that this starter expects you have installed elm-format globally.

Production

Build production assets (js and css together) with:

npm run prod

Static assets

Just add to src/assets/ and the production build copies them to /dist

Testing

Install elm-test globally

elm-test init is run when you install your dependencies. After that all you need to do to run the tests is

npm test

Take a look at the examples in tests/

If you add dependencies to your main app, then run elm-test --add-dependencies

Elm-analyse

Elm-analyse is a "tool that allows you to analyse your Elm code, identify deficiencies and apply best practices." Its built into this starter, just run the following to see how your code is getting on:

$ npm run analyse

Circle CI

$ circleci local execute --job build

ES6

This starter includes Babel so you can directly use ES6 code.

Changelog

  • 4.0.0 - Webpack 5, adds Tailwind support out of the box
  • 3.10.4 - Use better webpack defaults in dev mode
  • 3.10.0 - Css minify
  • 3.9.3 - Update deps
  • 3.9.2 - Update elm/core and other deps
  • 3.9.1 - Version 0.19.1
  • 3.9.0 - Switch the closure compiler for minification in prod
  • 3.8.0 - Update deps
  • 3.7.0 - Add elm-analyse
  • 3.6.0 - Add CI script
  • 3.5.0 - Simpler means to work with/out the debug window
  • 3.4.0 - Add ability to start dev mode without debug window
  • 3.3.0 - Switch to elm/http 2.0.0 (and other deps updates)
  • 3.2.0 - Add elm-minify to prod builds (thanks Asger)
  • 3.1.0 - Revert to webpack-dev-server with example
  • 3.0.2 - bugfixes (mostly for tests)
  • 3.0.1 - use publicPath to ensure compatibility with more complex routes
  • 3.0.0 - Version 0.19
  • 2.1.0 - switch to webpack-serve (from webpack dev server)
  • 2.0.0
    • Remove Bootstrap (use purecss as simple alternative - you don't want me choosing your css framework after all)
    • Compile CSS into separate file
  • 1.2.0 - Webpack 4, Babel 7
  • 1.1.0 - add elm-verify-examples

How it works

npm run dev maps to webpack-dev-server --hot --colors --port 3000 where

  • --hot Enable webpack's Hot Module Replacement feature
  • --port 3000 - use port 3000 instead of default 8000
  • inline (default) a script will be inserted in your bundle to take care of reloading, and build messages will appear in the browser console.
  • --colors should show the colours created in the original Elm errors, but does not (To Fix)

One alternative is to run npx webpack-dev-server --hot --colors --host=0.0.0.0 --port 3000 which will enable your dev server to be reached from other computers on your local network

Credits

A long time ago this code was forked from https://github.com/fluxxu/elm-hot-loader

More Repositories

1

ftp-deploy

Bulk upload to FTP server
JavaScript
288
star
2

elm-jwt

Json Web Token (JWT) helper functions for Elm
Elm
94
star
3

angular-http-server

Simple http-server for Single Page Apps (SPAs)
JavaScript
80
star
4

file-reader

Elm 0.18 native bindings for HTML5 FileReader API
Elm
70
star
5

elm-firebase-demo

Elm PWA with Firebase database, messaging and functions
Elm
30
star
6

elm-colorpicker

Elm library to implement a color picker tool
Elm
19
star
7

elm-s3-example

Uploading to S3 from Elm using file-reader
Elixir
18
star
8

elm-charts

Elm library for simple bar and pie charts
Elm
16
star
9

elm-sliding-menus

Animated, nested menus for mobile-first Elm webapps - ★
Elm
11
star
10

json-interpreter

Online interpreter for Elm's Json.Decode library
Elm
8
star
11

elm-phoenix-channels

Exploring Elm's new WebSocket library
JavaScript
8
star
12

google-analytics-service-accounts

Node library for Google Analytics REST API using service account
JavaScript
8
star
13

elm-google-maps

Demo of Elm with Google Maps
Elm
7
star
14

af-ng2-ngrx

Amsterdam Foodie, Angular2, ngrx
TypeScript
5
star
15

elm-phoenix-starter

Elixir / Phoenix - Elm starter (powered by Gulp)
Elixir
4
star
16

elm-websocket

Elm 0.19 websocket package
Elm
4
star
17

elm-google-maps-2

JavaScript
4
star
18

docpad-plugin-mongo

MongoDB plugin for Docpad
CoffeeScript
2
star
19

docker-elm

Simple Elm 0.19 container for Circle CI
Dockerfile
1
star
20

Minesweepers

Elm implementation of Minesweepers
Elm
1
star
21

elm-presentation

Demos for Leuven Haskell Users Group, Dec 2015
Elm
1
star
22

svelte-to-run

A PWA Start-to-Run app written in Svelte & Tailwind
JavaScript
1
star
23

elm-google-map-webcomponent

JavaScript
1
star