Skip to content

Instantly share code, notes, and snippets.

@deepak
Created September 14, 2016 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepak/33966e98a76f30d6db9e617bdab4685c to your computer and use it in GitHub Desktop.
Save deepak/33966e98a76f30d6db9e617bdab4685c to your computer and use it in GitHub Desktop.
elm-new.sh
function elm-new() {
mkdir -p $1
cd $1
# from https://github.com/github/gitignore/blob/master/Elm.gitignore
echo "# elm-package generated files
elm-stuff
# elm-repl generated files
repl-temp-*" > .gitignore
mkdir src
touch src/.gitkeep
# we get something like this from
# elm-package install elm-lang/core --yes
echo '{
"version": "0.0.1",
"summary": "TODO: helpful summary of your project, less than 80 characters",
"repository": "https://github.com/deepak/trying-elm.git",
"license": "BSD3",
"source-directories": [
"src"
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.17.0 <= v < 0.18.0"
}' > elm-package.json
elm-package install --yes
echo '<!DOCTYPE html>
<html lang="en">
<head>
<!-- These meta tags come first. -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TODO: add title</title>
<script type="text/javascript" src="/build/elm.js"></script>
</head>
<body></body>
<script type="text/javascript">
var app = Elm.Main.fullscreen();
</script>
</html>' > index.html
git init
git add .
git commit -m "initial commit"
touch src/Main.elm
echo "have a couple of TODOs"
ag todo .
elm-live src/Main.elm --open --pushstate --output=build/elm.js
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment