A snake clone in elm
In the project directory you can run:
Builds the app for production to the build
folder.
The build is minified, and the filenames include the hashes. Your app is ready to be deployed!
Runs the app in the development mode. Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits. You will also see any lint errors in the console.
You may change the listening port number by using the PORT
environment variable. For example type PORT=8000 elm-app start
into the terminal/bash to run it from: http://localhost:8000/.
Alias for elm install
Use it for installing Elm packages from package.elm-lang.org
Run tests with node-test-runner
You can make test runner watch project files by running:
elm-app test --watch
elm-app build
creates a build
directory with a production build of your app. Set up your favourite HTTP server so that a visitor to your site is served index.html
, and requests to static paths like /static/js/main.<hash>.js
are served with the contents of the /static/js/main.<hash>.js
file.
By default, Create Elm App produces a build assuming your app is hosted at the server root.
To override this, specify the homepage
in your elmapp.config.js
, for example:
module.exports = {
homepage: "http://mywebsite.com/relativepath"
}
This will let Create Elm App correctly infer the root path to use in the generated HTML file.
The step below is important!
If you skip it, your app will not deploy correctly.
Open your elmapp.config.js
and add a homepage
field:
module.exports = {
homepage: "https://myusername.github.io/my-app",
}
Create Elm App uses the homepage
field to determine the root URL in the built HTML file.
elm-app build
We will use gh-pages to upload the files from the build
directory to GitHub. If you haven't already installed it, do so now (npm install -g gh-pages
)
Now run:
gh-pages -d build
Finally, make sure GitHub Pages option in your GitHub project settings is set to use the gh-pages
branch:
You can configure a custom domain with GitHub Pages by adding a CNAME
file to the public/
folder.