Build loop for Elm?

136 views
Skip to first unread message

Rupert Smith

unread,
Sep 30, 2016, 10:53:55 AM9/30/16
to Elm Discuss
On Wednesday, September 28, 2016 at 8:18:26 AM UTC+1, Peter Damoc wrote:
There comes a point when you start needing to install tools with npm or bower. 
One starts to need makefiles (like Fred used) or gulp/webpack. 

If you use elm-reactor you get a build loop so localhost:8000 updates whenever you save the code.

I was just thinking, when moving on fro the reactor and creating your own grunt or gulp or whatever build, one of the first things you do is to set up a build loop.

As here:


This bit builds the elm files:

'elm': {
compile: {
files: {
'app/style-lab.js': ['src/elm/**/*.elm']
}
}
},


This bit runs the build loop watching for file changes:

'watch': {
'dev': {
files: ['Gruntfile.js', 'bower.json', 'elm-package.json', 'server.js', 'config.rb', 'src/**'],
tasks: ['build'],
options: {
atBegin: true
}
},
This sets up the server and build loop:

grunt.registerTask('dev', ['bower', 'connect:server', 'watch:dev']);

So if you want to get started gulp, try getting just far enough to set up a build loop.

After that, you can start incorporating more stuff into the loop that does works outside of Elm itself. Minifying, transforming images, maybe css, bower, triggering tests, and so on.

Владимир Кобеляцкий

unread,
Oct 1, 2016, 9:44:46 AM10/1/16
to Elm Discuss

I had the same wish, but wanted something more simplistic. Not a big fan of task runners. This is what I came up with: https://github.com/VKobeliatsky/empty-elm-project
Reply all
Reply to author
Forward
0 new messages