Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sphido/sphido

A rocket 🚀 fast, light-weight and flexible static site generator.
https://github.com/sphido/sphido

cms cms-framework generator markdown ssg static-site-generator

Last synced: about 2 months ago
JSON representation

A rocket 🚀 fast, light-weight and flexible static site generator.

Awesome Lists containing this project

README

        

# A rocket 🚀 fast, ️💭 lightweight and flexible static site 🤖 generator.

[![NPM Downloads](https://img.shields.io/npm/dm/@sphido/core?style=for-the-badge)](https://www.npmjs.com/package/@sphido/core)
[![NPM Version](https://img.shields.io/npm/v/@sphido/core?style=for-the-badge)](https://www.npmjs.com/package/@sphido/core)
[![NPM License](https://img.shields.io/npm/l/@sphido/core?style=for-the-badge)](https://github.com/sphido/sphido/blob/main/LICENSE)
[![Last Commit](https://img.shields.io/github/last-commit/sphido/sphido?style=for-the-badge)](https://github.com/sphido/sphido/commits/main)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sphido/sphido/main.yml?style=for-the-badge)](https://github.com/sphido/sphido/actions)

I know, another [static site generator](https://github.com/collections/static-site-generators)! This one is different - it's totally minimalistic.
Basically, it's just two functions. The first, the `getPages()` function, allows you to retrieve a list of pages, and the `allPages()` function allows
you to iterate through them.

You get a static site generator that is:

- 🚀 rocket fast
- 💭️ light-weight
- 🤘 no dependencies
- ⚡️ flexible

## Installation

```shell
yarn add @sphido/core
```

or

```shell
npm i @sphido/core
```

## Quick Start

```javascript
#!/usr/bin/env node

import {dirname, join, relative} from 'node:path';
import {allPages, getPages, readFile, writeFile} from '@sphido/core';
import slugify from '@sindresorhus/slugify';
import {marked} from 'marked';

const pages = await getPages({path: 'content'}, // ... extenders
(page) => {
page.slug = slugify(page.name) + '.html';
page.dir = dirname(page.path);
});

for (const page of allPages(pages)) {
page.output = join('public', relative('content', page.dir), page.slug);
page.content = marked(await readFile(page.path));

await writeFile(page.output, `




${page.name} | Sphido Example

${page.content}

`);
}
```

Sphido requires Node `16.x` and newer. To load an ES module, set `"type": "module"` in the `package.json` or use the `.mjs` extension.

## Run script

```shell
node index.js
```

## Packages

* [`@sphido/core`](https://github.com/sphido/sphido/tree/main/packages/sphido-core) - core functions `getPages()`, `allPages()`, `readFile()` and `writeFile()`

### Page extenders

* [`@sphido/frontmatter`](https://github.com/sphido/sphido/tree/main/packages/sphido-frontmatter) - frontmatter extender for `page`
* [`@sphido/hashtags`](https://github.com/sphido/sphido/tree/main/packages/sphido-hashtags) - process hashtags in `page.content`

### Website components

* [`@sphido/sitemap`](https://github.com/sphido/sphido/tree/main/packages/sphido-sitemap) - generate `sitemap.xml` file

## Examples

* https://github.com/sphido/examples/
* https://sphido.cz

## License

[MIT](./LICENSE)