cSSG is a simple Static Site Generator (SSG) built on top of Deno and TypeScript. Designed for ease of use (maybe) and speed (I'm not sure), cSSG lets you create static websites quickly without complex configurations (Nahh).
- Built with Deno: Enjoy a secure and modern runtime environment for JavaScript and TypeScript.
- Fast Build: Powered by esbuild to process JavaScript and CSS assets at lightning speed.
- Live Reload: Built-in development server with hot-reloading for a smooth workflow (Again, I'm not sure).
- Powerful Templating: Uses the Eta template engine, fast and compatible with EJS.
- Project Scaffolding: Quickly bootstrap new projects with the
createcommand. - Remote Templates: Use ready-to-go templates.
Before getting started, make sure you have installed:
- Deno
- Git: Required to clone templates from repositories.
Install the cSSG CLI globally using Deno:
deno install -A --global --name cssg jsr:@adityakurnias/cssgdeno install -A --global --name cssg jsr:@adityakurnias/cssg@0.0.450Note: Ensure that Deno’s installation directory is added to your system
PATHso that thecssgcommand can be accessed globally.
To create a new project, use the create command followed by your project name:
cssg create <project-name>Example:
cssg create cSSG-siteYou can also select a specific template from a remote repository using the --template flag:
cssg create cSSG-site --template counterCheck available templates with cssg list.
Navigate into your project directory and start the dev server with the dev command:
cd cSSG-site
cssg devThe server will run at http://localhost:3000 and automatically reload the page whenever you save changes in your project files.
To generate a production-ready version of your site, run:
cssg buildStatic files ready for deployment will be output to the dist directory (or another directory specified in your config).
A newly created cSSG project comes with the following structure:
.
├── public/
│ └── favicon.ico # Static assets, copied directly to output
├── src/
│ ├── assets/
│ │ ├── main.css # Processed assets (CSS, JS)
│ │ └── main.js
│ ├── data/
│ │ └── site.json # JSON data files, accessible in templates
│ ├── layouts/
│ │ └── main.eta # Layout templates
│ └── pages/
│ └── index.eta # Content pages
└── cssg.config.ts # Main project configuration file
public/: For static files such as images orrobots.txt. Contents are copied directly to the output directory.src/assets/: For CSS/JS assets that will be bundled by esbuild.src/data/: Place.jsonfiles here. They are merged and accessible in templates via thesiteobject.src/layouts/: Contains Eta layout templates. Pages can inherit from these.src/pages/: Your main content files (.etaor.html). Each file here becomes a page in your site.cssg.config.ts: Customize input/output directories and global site data.
You can configure cSSG behavior via cssg.config.ts.
Example:
import type { UserConfig } from "@adityakurnias/cssg";
const config: UserConfig = {
// Output directory
outDir: "build",
// Directory for static assets
publicDir: "static",
// Global site data available in all pages
site: {
title: "My Awesome Site",
description: "A website built with cSSG.",
},
});
export default config;Contributions are welcome! If you find a bug or have an idea for a new feature, please open an issue or submit a pull request on the GitHub repository.
This project is licensed under the MIT License.