Added Lamdera alternative implementation for HTML generation. #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added Lamdera alternative implementation for HTML generation only when building a Lamdera project, not regular Elm.
This means you can do
lamdera make src/Main.elm
with aBrowser.sandbox/document/application
and get an index.html output file that will run that application.Without this change some Lamdera extra stuff gets put in the HTML for running a Lamdera Live application, and the application hangs on startup looking for a websocket connection to the backend.
The alternative implementation is wrapped like this:
So contingent on the
Lamdera.isLamdera_
condition being true. This is true when the elm.json contains lamdera/core as a package, and there areTypes.elm
andBackend.elm
files under src/.Reason for this PR is the aim of making lamdera a drop-in replacement for Elm. Html generation is probably not used as much with Elm in production compared with generating an elm.json and a custom Html document, but worth consdering for completeness of providing a drop-in replacement for the
make
command.