After adding "elm" to the list of watched files in the elmBrunch confit, i noticed that the application does not display the results on the web page after building. I noticed that although the elm files are being compiled into js files, the elm.js is not being generated afterward - the existing elm.js is simply used again. I deleted the existing elm.js file and then received an error from app.js since it includes the elm.js.
I played around with this for awhile and it looks like there is an item missing from the elmBrunch provided in the instructions, which state:
1: add the following to the plugins section of your brunch-config.js
elmBrunch: {
mainModules: ['elm/Main.elm'],
outputFile: 'elm.js',
outputFolder: '../assets/js',
makeParameters: ['--debug'] // optional debugger for development
}
elmBrunch: {
// Set to path where elm-package.json is located, defaults to project root (optional)
// if your elm files are not in /app then make sure to configure paths.watched in main brunch config
**elmFolder: 'web/static/elm',**
// Set to the elm file(s) containing your "main" function
// `elm make` handles all elm dependencies (required)
// relative to `elmFolder`
mainModules: ['Main.elm'],
outputFolder: '../../../priv/static/js/elm'
}
},
...containing the entry elmFolder. I added this entry to the elmBrunch config for my phoenix elm scaffold project and it fixed the issue. The correct items are re-build and the web page is properly dynamically updated.
After adding "elm" to the list of watched files in the elmBrunch confit, i noticed that the application does not display the results on the web page after building. I noticed that although the elm files are being compiled into js files, the elm.js is not being generated afterward - the existing elm.js is simply used again. I deleted the existing elm.js file and then received an error from app.js since it includes the elm.js.
I played around with this for awhile and it looks like there is an item missing from the elmBrunch provided in the instructions, which state:
1: add the following to the plugins section of your brunch-config.js
elmBrunch: { mainModules: ['elm/Main.elm'], outputFile: 'elm.js', outputFolder: '../assets/js', makeParameters: ['--debug'] // optional debugger for development }
I did some research against other web sites attempting to do the phoenix/elm configuration and found the following at https://www.dailydrip.com/topics/elixirsips/drips/phoenix-and-elm:
},
...containing the entry elmFolder. I added this entry to the elmBrunch config for my phoenix elm scaffold project and it fixed the issue. The correct items are re-build and the web page is properly dynamically updated.