Shokunin Installation Prerequisites: Get the Fastest SSG

Install Shokunin on macOS, Linux, Windows, and leverage its simplicity and power to create static websites, blogs and microsites with ease.

divider

Installation

It takes just a few minutes to get up and running with Shokunin Static Site Generator (SSG).

To install Shokunin Static Site Generator (SSG), you need to have the Rust toolchain installed on your machine. You can install the Rust toolchain by following the instructions on the Rust website.

Once you have the Rust toolchain installed, you can install Shokunin Static Site Generator (SSG) using the following command:

cargo install ssg

For simplicity, we have given Shokunin Static Site Generator (SSG) a simple alias ssg which can stand for Shokunin Site Generator or Static Site Generator.

You can then run the help command to see the available options and commands:

ssg --help

Requirements

The minimum supported Rust toolchain version is currently Rust 1.72.0 or later (stable). It is recommended that you install the latest stable version of Rust.

Platform support

Shokunin Static Site Generator (SSG) is supported and tested on the following platforms and architectures as part of our CI/CD pipeline.

This list is based on the Rust Platform Support list.

The GitHub Actions shows the platforms in which the Shokunin Static Site Generator (SSG) library tests are run.

Documentation

Info: You can find our documentation on docs.rs, lib.rs and crates.io.

Usage

Command Line Interface (CLI)

The Shokunin Static Site Generator (SSG) library runs in a Terminal window and can be used to generate a static website.

Here’s the first command you can enter in your Terminal window to run Shokunin Static Site Generator (SSG):

ssg  --new=docs --content=content --template=template --output=output --serve=public

or

ssg  -n=docs -c=content -t=template -o=output -s=public

This command will create a new website with the name docs in the current directory. It will use the content directory to gather the website content and the template directory to generate the website files. It will serve the website directly from the docs directory.

Arguments

In your project

To use the Shokunin Static Site Generator (SSG) library in your project, add the following to your Cargo.toml file:

[dependencies]
shokunin = "0.0.26"

Add the following to your main.rs file:

extern crate ssg;
use ssg::*;

then you can use the Shokunin Static Site Generator (SSG) functions in your application code.

Examples

To get started with Shokunin Static Site Generator (SSG), you can use the examples provided in the examples directory of the project.

To run the examples, clone the repository and run the following command in your terminal from the project root directory.

cargo run --example example

The command will generate a static website based on the configuration details in the examples directory.

use ssg::compiler::compile;
use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Define the paths to the build, site, content and template directories.
    let build_path = Path::new("examples/example.com/build");
    let content_path = Path::new("examples/example.com/content");
    let site_path = Path::new("examples/example.com/public");
    let template_path = Path::new("examples/example.com/template");

    compile(build_path, content_path, site_path, template_path)?;

    Ok(())
}

The main() function in this code compiles a website from the content directory, using the template directory to generate the website files. The compiled website is saved in the build directory and served directly from the example.com directory.

Args

Quick Start

You are now ready to use Shokunin and create amazing websites!