DEV Community

CDPhu
CDPhu

Posted on

my-button-ssg

The first day of OSD600, the class was asked to create a Static Site Generator (SSG) as the first assignment of the course. We were given the freedom to choose what language the assignment was done in. I decided to name my project "my-button-ssg", as it was a simple name that represents me. I then chose my language of choice which happens to be in JavaScript.

my-button-ssg

my-button-ssg is a program that generates HTML files based on user command-line input. For example, we have 5 .txt files provided by our professor David Humphrey. These are chapters reading from the book "Sherlock-Holmes". With a simple command, my-button-ssg could convert all of these .txt files into HTML files.

Features

  1. I make my code takes the first line of the .txt file which generally was as the title and put then to the <title> </title> and add it into <h1> </h1> to the top of the <body>.
  2. used my own <footer></footer>.

Usage

Clone the source code from Github
Open the source file with Visual Studio Code
Install the npm package 'npm install' and yargs by npm -i yargs

Options

Use the command node server.js -h to get help information.
Use the command node server.js -v to check the version.
Use the command node server.js -i filename.txt to convert singular file into .\dist folder
Use the command node server.js -i .\foldername\ to convert contents of folder into .\dist folder

Links

Click Here for the DEMO link.

Link to Repository

Top comments (0)