sporto / elm-example-app

An example Elm single page application
436 stars 85 forks source link

Suggestion: switch webpack inline config to CLI #31

Open ErikSvaleng opened 7 years ago

ErikSvaleng commented 7 years ago

Hi sporto,

Thank you so much for this thorough and understandable elm tutorial! Awesome work!

Small suggestion. I'm probably just completely n00b as I haven't used webpack before, but to get the src folder as root on the dev server i had to supply --inline as a parameter in the package.json script, the inline option in the webpack.config didn't work for me. Most of it still works even if src is in the url, except the fonts aren't loaded. The webpack docs seem to be somewhat contradictive on this but on this page: https://webpack.js.org/configuration/dev-server/ it says that devServer.inline - CLI only. I'm totally guessing interpreting this to mean the webpack.config option doesn't work

EDIT: So, did not experience this on my linux setup, only on windows.

s0kil commented 6 years ago

Yes, the server fails to start, webpack says it needs webpack-cli package.

kanuku commented 6 years ago

I got rid of all webpack packages and am using elm-live instead.

This is how the structure of the project looks like:

# content of ./index.html
<!DOCTYPE html>
<html>
  <head>
     <link href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
    <script type="text/javascript" src="//localhost:35729/livereload.js?snipver=1" async="" defer=""></script>
  </head>

  <body>
    <div id="elm-code-is-loaded-here"></div>

    <script src="elm.js"></script>
    <script>
      Elm.Main.embed(document.getElementById("elm-code-is-loaded-here"));
    </script>

  </body>
</html>

Run elm-live as following:

elm-live src/Main.elm --open --output=elm.js
sporto commented 6 years ago

Yes, elm-live is great. I'm planning to use it for the update to 0.19.