Octo: The Open Source Static Site Generator
Tags: javascript, opensource, showdev
Published: 2021-09-15 02:56:52

After my [first blog post](https://dev.to/luigizaccagnini/starting-my-journey-in-opensource-1m4n) I decided what was a better way to start into open source then building my own open source project! I then built a static site generator in Javascript called [Octo](https://github.com/LuigiZaccagnini/octo). The project was created with the idea of shipping a finished product is better than shipping when the product is perfect. This is important because if I shipped a perfect product, I would not be writing this post and most likely would still be writing code for an infinite amount of time.

## What is a Static Site Generator?
A SSG(static site generator) is a tool that creates static HTML pages based off of a template or some raw data provided. Octo is designed to only accept .txt files and create static html documents based off of the content within the text files. Octo will read the text data and make paragraph elements every time there is a space between content. 

## Tool Setup

### Installation 
This builds Octo so you can access it anywhere on your computer using the <code>octo</code> command. 

* Clone the repository 
* cd into the folder 
* run npm i to install all dependencies 
* run npm install -g .

## Features

### Input
The <code>-i or --input</code> flag means the input path. This will look for all texts files with the given path. You can give a .txt file as input or a directory. This is a required field for the program to work. Any files/directories with spaces should be entered with quotes: 
<pre>octo -i "Sherlock Holmes Selected Stories/test.txt"</pre>
<center>**Only text files work with this program.**</center>
</br>

#### Examples

##### File Input
This will take the content from the text file and output a HTML file.
<pre>
    octo -i test.txt
</pre>

##### Directory Input
This will go though a directory named test and look for all nested .txt files.
<pre>
    octo -i test
</pre>

### Output
The output allows the user to specify the path where the files/directories can be exported. 
This is not a required field and will default to './dist' if no option is given.

#### Examples
The <code>-o or --output</code> flag means the output path. This will create a folder called htmlFiles outside of the current directory.
<pre>
    octo -i test.txt -o ../hmtlFiles
</pre>

### Recursive File Searching
If a input is a directory, Octo will recursively go through all the child directories and convert all the text files into HTML.

## Conclusion
After creating my own open source project, I was able to grow as a software developer! Although it may seem to be not as difficult of a task, the few things that were difficult for me were: 
* Publishing my code online for everyone to see
* Submitting code that could possibly be buggy
* Not having a 100% completed software

Those thoughts might have made it difficult at first but, I was able to move past this and understand that **these things are okay!** Comment some features that you would like to see with this project, I would love to add them to the Github repository. I am also excited to get pull requests from people in the community to help make this tool better! If you want to contribute to the project or check out the link to the sample site, the links will be under here!

Source | Link
------------ | -------------
Github Repository | https://github.com/LuigiZaccagnini/octo
Sample Site | https://luigizaccagnini.github.io/octo/