Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
vanilla-ssg
Advanced tools
A very minimalistic, single function static site generator based on ES6 template strings.
A very minimalistic, single function static site generator based on ES6 template strings.
It makes use of the minimalistic renderly
package (https://github.com/gcazaciuc/renderly) for rendering the templates.
Install the vanilla-ssg package:
npm i vanilla-ssg
The vanilla-ssg package is meant to be used programatically in order to generate static sites.
This is the simplest and most flexible way.
After installing, create a Javascript file that will contain the code for the generator.
Let's call it generate.js
:
const { createPage } = require("vanilla-ssg");
const createClient = require("../HttpClient");
const client = createClient();
(async function() {
const posts = await client.get("https://jsonplaceholder.typicode.com/posts");
createPage(`posts`, { posts }, `examples/posts.tpl`);
posts.forEach(post => {
createPage(`posts/${post.id}`, post, `examples/post.tpl`);
});
})();
There is a single API method called createPage
taking in the
page url, page data and the template to apply.
It's output is an HTML file that is written to disk.
The purpose of the script is to retrieve any needed data to generate the site and to call createPage
API in order to create the HTML.
FAQs
A very minimalistic, single function static site generator based on ES6 template strings.
The npm package vanilla-ssg receives a total of 0 weekly downloads. As such, vanilla-ssg popularity was classified as not popular.
We found that vanilla-ssg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.