npm

Need private packages and team management tools?Check out npm Orgs. »

splendid

1.9.5 • Public • Published

splendid

npm version

splendid is a fast static website generator for Node.js. It supports templates, some markdown and is easily extensible - you can add your own replacements to pass to the replacement stream. The processor will also extract resources such as links and styles which are referenced locally, and place them in the build folder.

Installing

yarn install global splendid

Usage

splendid when called from the command line will trigger a build. It will read the splendid/config.js relative to the cwd.

$ splendid
 
created page markdown.html
created page index.html
created page highlightjs.html
copied styles/app.css to website/styles/app.css
copied styles/default.css to website/styles/default.css
copied img/favicon.ico to website/img/favicon.ico
copied img/logo.jpg to website/img/logo.jpg
copied js/main.js to website/js/main.js

The --watch flag will result in observing files in the app directory for changes (including the config) and rebuilding when necessary.

Splendid Configuration

A configuration object for a new website can use import statements.

import { join } from 'path'
 
const APP_DIR = 'splendid'
const BUILD_DIR = 'docs'
 
/** @type {import('splendid').Config} */
const config = {
  appDir: APP_DIR,
  layout: join(APP_DIR, 'layout/main.html'),
  replacements: [
    {
      re: /{{ company }}/g,
      replacement: '[Splendid](https://splendid.sh)',
    },
  ],
  output: BUILD_DIR,
  // to generate sitemaps:
  /* url: https://website.github.io/splendid */
}
 
export default config

Pages Configuration

Each page need to be specified in the Pages config.

/**
 * @type {import('splendid').Page}
 */
export const main = {
  title: 'Main Page',
  url: 'index.html',
  file: 'index',
  menuUrl: '/',
}

The path to the file is relative to the pages dir.

structures/website/splendid/pages
├── index
│   ├── 1-intro.html
│   └── index.md
└── index.js

Default Structure

splendid comes with a simple default website. To initiate splendid in the current working directory with the default structure, run splendid --init (or the shorter version is splendid -I).

$ MacBook:test-website zavr$ splendid --init
Added Dockerfile, nginx.conf, splendid to .
Run splendid again to compile.

Development Server

To serve the static website locally during the development of the website, the development server is added to splendid. It will be started on http://localhost:5000 with the splendid -s command.

Copyright

(c) Splendid 2018

install

npm i splendid

Downloadsweekly downloads

133

version

1.9.5

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability