Socket
Socket
Sign inDemoInstall

ssg-api

Package Overview
Dependencies
107
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ssg-api

Static Site Generation TypeScript API


Version published
Weekly downloads
6
decreased by-45.45%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

[1.7.4] - 2024-04-13

Fixed

HTML lang overrides lang from filename.

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

Last updated on 12 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc