npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

printing-press

v0.4.2

Published

A Markdown static site generator built in TypeScript

Downloads

2

Readme

Printing Press

Printing press is a no dependencies static site generator (SSG) built in Typescript. Write your content in Markdown and your templates in a ejs-like syntax.

Why should I use this instead of others SSGs?

Honestly, you shouldn't: this project was made mostly because I thought that building my own SSG would be an interesting side project, which means that this project may not contain all features you would like to use and not be as stable as other projects. If you want to write content in Markdown, I'd recommend using Hugo or Jekyll. If you want a more generic approach, I'd recommend Next.js or Gatsby.

This project is intended to those that:

  • Have a technical background on web development
  • Want to be able to integrate their SSG with other JS tooling
  • Think that dependencies are to be avoided when possible
  • Want to write content in Markdown and fully customize the templates

Installing

This project can installed either by npm/yarn (recommended) or by directly building it.

NPM Package (recommended)

To install using yarn:

yarn add printing-press --dev

To install using npm

npm install printing-press -D

Building

If you don't want to use the npm package, you can build the project by running:

git clone https://github.com/impadalko/printing-press.git
cd printing-press
yarn install
yarn build
yarn link

This will make the command printing-press available at your command line.

Writing your site

An example of a built site can be seen here. This project requires both content files and template files. This project also support a public folder (also known as a static folder).

Content Files

The content files are composed by two parts: the header and the content itself.

Header

A header is defined by a structure like:

+++
key1: value1
key2: value2
...
+++

Most keys are arbitrary strings you define and that can be then used in your templates. Some special keys are:

  • template: Defines which template will be used for building this file (relative to the template folder root)
  • draft: If set to true this file will be ignored

Note that the header is required even if no keys are defined.

Content

After the header, everything will be treated as your content in Markdown and it will be translated to the final HTML.

File structure

The file structure of your content folder will be the same of the output folder. For example, a content folder with the following structure:

└── content/
    ├── index.md
    └── blog/
        ├── index.md
        └── about.md

would generate an output folder with the following structure:

└── output/
    ├── index.html
    └── blog/
        ├── index.html
        └── about.html

Template files

The template files follow an ejs-like syntax (but without code execution). The build method will search for patterns like <%= string %> and replace them for either the value in the header with the key equal the specified string (if existent). If the specified string is equal content, the build process will replace it will be the compiled markdown.

Public Folder

The public folder (also known as static folder) contains files that will be copied as they are to the output folder: useful for things like images, css etc.

Building your site

CLI

A CLI is available by running:

yarn run printing-press

or

npx printing-press

The configuration is made through a JSON file named .printingpressrc placed in the folder where you will run the command.

The required keys are:

  • template: Path to your template files.
  • content: Path to your content files.
  • output: Path to save the output of the building process.

The optional keys are:

  • public: Path to your public folder
  • defaultTemplate: Default template to use when there is no template specified by the content file

An example of this file can be seem here

API

A Node.js API is available and a basic documentation can be acessed at https://impadalko.com/printing-press/