Socket
Socket
Sign inDemoInstall

ssg-api

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssg-api

Static Site Generation TypeScript API


Version published
Weekly downloads
21
increased by50%
Maintainers
1
Weekly downloads
 
Install size
Created

Changelog

Source

[1.4.1] - 2023-01-21

Added

  • Overridable method to allow processing a content file.

Readme

Source

ssg-api CircleCI

TypeScript API to generate output files from input files.

It can be used to generate:

  • a static website from HTML templates (but those templates can include client-side JavaScript and CSS of course).
  • (and/or) other files such as configuration files (for instance converting an .htaccess file to a netlify.toml file)

To install ssg-api as a project dependency:

npm install --save ssg-api

Then import the required types to implement your own SSG code:

import {Ssg, SsgContextImpl, SsgConfig} from "ssg-api";

const config: SsgConfig = {outDir: "out"};
const ssg = new Ssg(config)
  .add(firstStep)
  .add(nextStep); // Write your own SSG steps!

const context = new SsgContextImpl("fr");
try {
  const result = await ssg.start(context);
  context.log("Completed", result);
} catch (err) {
  context.error(err, context.inputFile.name, "=>", context.outputFile.name);
}

Steps can do anything. You can implement your owns, but there are predefined ones. Check the documentation for more.

Keywords

FAQs

Package last updated on 22 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc