DEV Community

Rudy Chung
Rudy Chung

Posted on • Updated on

How the SauSaGe gets made

I just finished making my SauSaGe (Static Site Generator), excuse my idea of a "creative name".

The Process

I chose to create my SSG in C++ because I was familiar with how it handled file reading, which this project required a decent knowledge of.

In order to create and remove directories, I required the filesystem standard library which was introduced in C++17. I was not familiar with the library at the time of starting the project. But, I managed to learn what I needed to using reference material available online.

Something else I needed to learn was how to work with command line arguments in C++. It turned out to be more mundane than I thought it was. However, I am not 100% sure that the way I have done it is the standard method of getting it done.

Overall, I found the process of creating this project to be helpful in learning some new ideas in a programming language I thought I was familiar with.

How to use

To use the program, download the SauSaGe.exe file from the repo and execute it in a command line interface (i.e. PowerShell, cmd) with one of the following options:

  • -v or --version - display the application name and version
  • -h or --help - display application options
  • -i or --input - set the input file/directory
  • -o or --output - set the output directory (./dist by default)

HTML files will be generated based on the file(s) specified as input. The output directory specified will be deleted and re-created. The output file(s) will be placed into the output directory or dist by default.

Usage Examples

  • SauSaGe -i textFile.txt
  • SauSaGe -i inputDir
  • SauSaGe -i inputDir -o outputDir

Optional Requirements Implemented

  • Parses title from input files, changes HTML page title and header accordingly.
  • -o and --output options allow specification of output directory.
  • Recursively searches directory structure for text files and converts all of them into .html files.
  • Creates an index.html file that links to the output files created if a directory is specified as input

Top comments (0)