Skip to content

Instantly share code, notes, and snippets.

@jblakeman
Last active February 20, 2016 17:55
Show Gist options
  • Save jblakeman/0651b3a3495495b478f4 to your computer and use it in GitHub Desktop.
Save jblakeman/0651b3a3495495b478f4 to your computer and use it in GitHub Desktop.
HTML Boilerplate Generator
# Output HTML boilerplate code to a file name specified by the first argument
# If no arguments are provided, outputs to index.html
# example:
# html_boilerplate example.html
html_boilerplate() {
[[ $1 ]] || {
echo "usage: $FUNCNAME outfile"
return 1;
}
local name="$1"
if [[ $name ]]; then
[[ $name != *.html ]] && name+=.html
fi
[[ -f $name ]] && {
echo "error: $name currently exists as a file."
return 1;
}
cat << EOF > "$name"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
</html>
EOF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment