DEV Community

Cover image for palpatine 0.1.0
Batuhan Ipci
Batuhan Ipci

Posted on • Updated on

palpatine 0.1.0

What is palpatine?

palpatine is a minimal static site generator (SSG) built with CMake and written in C++17. It is a command line tool that takes a directory of raw data and generates a static website. It is designed to be fast, simple, and easy to use.
Palpatine is also my favorite villain, the most powerful Sith Lord ever from Star Wars.

How to use it?

After cloning the repository from github, you can build the project with CMake. If you don't have experience using CMake, don't worry, all you need to do is to run make prepare in the root directory of the project. This will run the prepare directive from the Makefile in the project and generate the executable file palpatine in the build/app directory. You can then run the executable file with ./palpatine to see the usage of the tool. Examine the Makefile to see what happens in the background.

Note: Currently, palpatine only supports txt file as input but soon it will support markdown.

Demonstration of how to use palpatine

# Clone this repository
$ git clone

# Go into the repository
$ cd palpatine

# Build project w/ CMake and install dependencies 
$ make prepare

# Run the script
$ ./palpatine -i <input> -o <output> -s <stylesheet>
Enter fullscreen mode Exit fullscreen mode


Flag Description Required / Optional
-i Specify raw data directory or file e.g. use data directory in the codebase Required
-o Specify the particular directory that you want to generate static sites to. Optional
-s If you please, you can add custom stylesheets by specifying the css files.
By default it uses bahunya
-h This will display all the available options Optional


The following dependencies will be installed in the external directory:

  • p-ranav/argparse - A single-file header-only C++11 library for parsing command line arguments.
  • ikalnytskyi/termcolor - A header-only C++ library for printing colored messages to a terminal.


  • [x] Generate a static site from a directory of text files
  • [x] Generate a stylesheet file for the static site
  • [x] Option to change the output directory
  • [x] Option to include a custom stylesheet link
  • [x] Generate a list of all pages in a directory, with links to each page
  • [x] Parse page title from the first line of the file if given

How to use external libraries in CMake?

Here is a demonstration of how I used in palpatine GitSubModules

  • i. Use this below command convenient to add external libraries to your project as a submodule. The below library is one of the libraries I used in palpatine. You can use any library you want.
 git submodule add external/argparse
Enter fullscreen mode Exit fullscreen mode
  • ii. Then create cmake folder in your project. mkdir cmake (we will add CMake functions)
  • iii. Create AddGitSubmodule.cmake file in the cmake folder.
  • iv. Then add the following code to the AddGitSubmodule.cmake file:
 function(add_git_submodule dirname)
 find_package(Git REQUIRED)

 if(NOT EXISTS ${dirname}/CMakeLists.txt)
 execute_process(COMMAND ${GIT_EXECUTABLE}
 submodule update --init --recursive -- ${dirname}

Enter fullscreen mode Exit fullscreen mode
  • v. In the root CMakeLists.txt file, add the following code to finally call the function we have written above:
 add_git_submodule(external/argparse) # add any library you want
Enter fullscreen mode Exit fullscreen mode
  • vi. We can link this external library we finally have added with our executable. Navigate to your app CMakeLists.txt file and add the following code:
 target_link_libraries(${EXECUTABLE_NAME} PUBLIC argparse)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)