26·9
2016
Occasionally I have to create complex folder structures, for example, creating a new project. With the -p flag it's pretty easy creating parent and child folders in terminal.
mkdir -p thisfolder/thatfolder/myfolder
The -p flag creates all the required parent folders. Nice!
If you want to get real fancy, create a genProject shell script and run it every time you want to start a new html based project. This one includes the HTML boilerplate and a simple css reset to boot.
#set the inputFolder variable - use the .sh file like => $ genProject inputFolderName
inputFolder=$1
# Make all these call folders and files
mkdir $inputFolder
cd $inputFolder
mkdir scripts styles
touch scripts/script.js styles/style.css index.html
# pipe the following echo contents to index.html
echo '<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="description" content="<!-- add description here -->">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="styles/reset.css">
<link rel="stylesheet" type="text/css" href="styles/style.css">
</head>
<body>
<script type="text/javascript" src="scripts/script.js"></script>
</body>
</html>' > index.html
#pipe the following echo contents to reset.css
echo 'html, body, ul, ol, li, form, fieldset, legend
{
margin: 0;
padding: 0;
}
h1, h2, h3, h4, h5, h6, p { margin-top: 0; }
fieldset,img { border: 0; }
legend { color: #000; }
li { list-style: none; }
sup { vertical-align: text-top; }
sub { vertical-align: text-bottom; }
table
{
border-collapse: collapse;
border-spacing: 0;
}
caption, th, td
{
text-align: left;
vertical-align: top;
font-weight: normal;
}
input, textarea, select
{
font-size: 110%;
line-height: 1.1;
}
abbr, acronym
{
border-bottom: .1em dotted;
cursor: help;
}' > styles/reset.css
# open your project in sublime
subl .