Socket
Socket
Sign inDemoInstall

jsonblog-generator-boilerplate

Package Overview
Dependencies
29
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jsonblog-generator-boilerplate

This is the default generator for JSON blog and built as an example for people looking to build `generators`.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
8.26 MB
Created
Weekly downloads
 

Readme

Source

Json Blog Generator Boilerplate

This is the default generator for JSON blog and built as an example for people looking to build generators.

In short, a generator is a function that takes a parsed blog.json and returns an array of filenames and corresponding contents of those files.

The output should be saved to the file system.

const generator = (blogObject) => {
  const siteName = blogObject.site.name;
  const templateHTML = "<h1>{siteName}</h1>";
  const fileContent = templateHTML.replace("{siteName}", siteName);
  const files = [];
  files.push({
    content: fileContent,
    path: "index.html",
  });
  files.forEach((file) => {
    fs.writeFileSync(file.path, file.content);
  });
};

generator({ name: "Ajax" });
// index.html
//<h1>Ajax</h1>

JSONBlog is code agnostic so feel free to attempt making a generator in another language.

Theoretically, a generator can generate the code required for any blog framework too.

One blog to rule them all.

FAQs

Last updated on 30 Mar 2022

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