Add prototype file for compiling elm module from NodeJS.

This commit is contained in:
Dillon Kearns 2019-08-19 10:08:47 -07:00
parent 62cd55d076
commit 21a7d1160e
2 changed files with 13 additions and 1 deletions

12
compile-elm.js Normal file
View File

@ -0,0 +1,12 @@
var compile = require("node-elm-compiler").compile;
var compileToString = require("node-elm-compiler").compileToString;
process.chdir("./examples/docs/");
compileToString(["./src/Main.elm"], {}).then(function(data) {
eval(data.toString());
const app = Elm.Main.init({ flags: { imageAssets: {} } });
app.ports.toJsPort.subscribe(payload => {
console.log("payload", payload);
});
});

View File

@ -26,7 +26,7 @@
"glob": "^7.1.4",
"gray-matter": "^4.0.2",
"html-webpack-plugin": "^3.2.0",
"node-elm-compiler": "^5.0.3",
"node-elm-compiler": "^5.0.4",
"prerender-spa-plugin": "^3.4.0",
"sass-loader": "^7.2.0",
"style-loader": "^1.0.0",