How To's

Create your own HTML boilerplate script with Bash

6,678 views · 0 found this helpful

Was this helpful?

Boilerplates are an easy way to speed up the process of making a website. There are several popular boilerplates out there to choose from, but for fun we are going to create our own simple Bash script that will set us up with all the basic files and folders we need to have a webpage up and ready to work on. For the sake of keeping this article as simple as possible, we will be assuming you are working from a basic LAMP stack.

Create a file for your script and change its permissions. We will be putting our code into this file.

touch boilerplate.sh
chmod 755 boilerplate.sh

We'll start off the script by declaring a variable that will be used to name our website's parent directory. Then we'll create all the sub-directories for our CSS, PHP and our jQuery/Javascript files respectively.

#Name our website's parent directory
website="Website"

# Create directory in /var/www/html/
mkdir /var/www/html/$website
cd /var/www/html/$website

# Create sub-directories
mkdir css
mkdir inc
mkdir js

Next, we'll download a CSS reset file and jQuery and put them in their respective folders.

# Download reset.css and jQuery
wget -P js/ http://code.jquery.com/jquery-1.11.3.min.js
wget -P css/ http://meyerweb.com/eric/tools/css/reset/reset.css

Now we'll need an index page and a CSS file to start us off.

# Create files
touch index.php
touch css/style.css

Put it all together and you should have yourself a good starting point for a basic website.

  • Updated

← All articles

Still stuck?

Our engineers answer tickets directly, 24/7.