Last active
July 14, 2022 15:06
-
-
Save tholman/5052311 to your computer and use it in GitHub Desktop.
Shell script to create new basic html/js/css project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Ensure a name parameter has been provided | |
if [ $# -eq 0 ] | |
then | |
echo "Please provide a project name" | |
exit 1 | |
fi | |
# Save project name | |
PROJECT_NAME="$1" | |
# CSS + JS CONTENT | |
function ACTIVE_BODY | |
{ | |
echo "/*! | |
* $PROJECT_NAME | |
* | |
* MIT licensed | |
* Copyright (C) 2013 Tim Holman, http://tholman.com | |
*/ | |
/********************************************* | |
* | |
*********************************************/" | |
} | |
# HTML CONTENT | |
function HTML_BODY | |
{ | |
echo "<!doctype html> | |
<html> | |
<head> | |
<title> $PROJECT_NAME </title> | |
<!-- CSS --> | |
<link href='./css/styles.css' rel='stylesheet'> | |
<!-- JS --> | |
<script src='js/$PROJECT_NAME.js'></script> | |
</head> | |
<body> | |
</body> | |
</html>" | |
} | |
# Create The directories | |
mkdir -p "$PROJECT_NAME" | |
mkdir -p "$PROJECT_NAME/js" | |
mkdir -p "$PROJECT_NAME/css" | |
# CSS | |
touch "$PROJECT_NAME/css/styles.css" | |
ACTIVE_BODY > "$PROJECT_NAME/css/styles.css" | |
# JS | |
touch "$PROJECT_NAME/js/$PROJECT_NAME.js" | |
ACTIVE_BODY > "$PROJECT_NAME/js/$PROJECT_NAME.js" | |
# INDEX | |
touch "$PROJECT_NAME/index.html" | |
HTML_BODY > "$PROJECT_NAME/index.html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, to be more actually, use the HTML5 base model:
<title>Document</title>