From the first day being in the OSD 600, we had been asked to make a Static Site Generator(SSG) as our first assignment in this course. Although we are free to choose any language we like to make this project, I chose the only language that I think I'm good at comparing to other coding languages which is JavaScript.
After picking a language, the next thing I need to do was give it a name. Since I'm not good at naming anything, I just called it as "My-First-SSG".
My-First-SSG
My-First-SSG is a program as its name. It generates a HTML file base on the user input .txt file or input folder that contains some .txt files.
For example, we have 5 .txt files as a test files from our professor David Humphrey. These are chapters reading from the book "Sherlock-Holmes". And My-First-SSG could convert all of these .txt files to HTML files with only one command.
Features
Except the basic features, I also required to add 2 or more optional features for My-First-SSG.
- 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>
. - I make my own
<footer>
.
Example [Step By Step]
- Clone the source code from Github
- Open the source file with Visual Studio Code
- Install the package yargs by
npm -i yargs
- 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 Silver Blaze.txt
to run the code, which will generate a SilverBlaze.html file into the ./dist folder. - Use the command
node server.js -i .\Sherlock-Holmes-Selected-Stories\
to run the code, which will generate a bunch of html files with a specific name bases on the .txt files that the Sherlock-Holmes-Selected-Stories contains, and put them into the ./dist folder.
Demo
Click here to check the Demo.
Since this is the first version of "My-First-SSG", there are more and more features coming up soon!
Link to the repository: [https://github.com/DerekJxy/My-First-SSG]
Top comments (0)