Phoenix Elm Scaffold v0.2.6 Mix.Tasks.Phx.Gen.Elm
Generates an elm app inside a Phoenix (1.3) app with the necessary scaffolding
adds:
- elm files (
Main,Types,State,View) - an embed script
elm-package.json- A phoenix
controller,viewandtemplate - an
elm-testsetup
to run the generator:
> mix phx.gen.elm
then follow post install instructions:
add the following to the
pluginssection of yourbrunch-config.jselmBrunch: { elmFolder: '.', mainModules: ['elm/Main.elm'], outputFile: 'elm.js', outputFolder: '../assets/js', makeParameters: ['--debug'] // optional debugger for development }add
elmto thewatchedarray in yourbrunch-config.jsYou may also want to add/elm\.js/to the babel ignore pattern to speed up compilationbabel: { ignore: [/vendor/, /elm.js/] }in your
app.jsfile add the followingimport ElmApp from './elm.js' import elmEmbed from './elm-embed.js' elmEmbed.init(ElmApp)and finally in your
router.exfile addget "/path-to-elm-app", ElmController, :index
Summary
Functions
A task needs to implement run which receives
a list of command line args.
Callback implementation for Mix.Task.run/1.