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

mister_hyde

v0.1.8

Published

MrHyde is a lightweight and simple static website generator using Liquid and Markdown templates.

Downloads

2

Readme

To scan a folder ./example

$ mrHyde scan ./example

To generate from a folder ./example to ./out

$ mrHyde run ./example ./out

To generate from a folder ./example to ./out in watch mode ↴

$ mrHyde run ./example ./out -w

To start in dev mode, from a folder ./example to ./out, and exposing the generated content to http://localhost:8080

$ mrHyde dev ./example ./out -p 8080

And for more, see usage 🚀

What's that?

MrHyde is a very simple and lightweight static website generator. MrHyde allow to build simple (or complex, that's up to you) static websites, using HTML templates and markdown. As for others generator, minimal componants to create a blog are also included.

MyHyde is powered by LiquidJs & Marked 🧙‍♂️

What's a static website and why should I care

A static website is serverless website, i.e. meaning that you don't need to write and run your own web server. You'll still need some server to serve your static files, but that's a much easier problem to have as there's free services (like Github Pages) that'll do that for you, free of charges.

Is'nt it just like Jekyll?

Yes, hence the name. This is a pet project, made to be lightweight and have just the minimum of features required to be effectively used. Jekyll in comparison is (a lot) more mature, and have a plethora of features that MrHyde won't ever have.

Usage

Getting started

Installation ↴

$ npm install -g mrHyde

Usage from ./example to ./out

$ mrHyde run ./example ./out

You may also start in watch mode to automatically re-run the generation when any file is modified ↴

$ mrHyde run ./example ./out --watch

Only scanning the directory is also possible ↴

$ mrHyde scan ./example

Finally, if you're actively working you might want to start the application in dev mode, which active the watcher and expose the out directory to HTTP ↴

$ mrHyde dev ./example ./out -p 8080

Project structure

A project should follow this organisation:

The generated files will keep their original path and name once processed into the output directory.

Special directories & files

Any file or directory starting with an underscore will be ignored during the processing. Ignored files may but indirectly used, as the _template.liquid file.

The _template.liquid file is a special file that will be used along with all the other pages present its own folder. This file is required for markdown and yaml files, as they don't have an easy way to produce complete HTML on their own.

The asset directory should be used to store assets that won't be processed by MrHyde and referenced by the differents pages

Metadata

Any file can contain metadata. This metadata is defined in yaml at the first of the file, and will be passed either to the template (if a template is used), or to the parent directory.

MrHyde will also had some convenient metadata, such as the date of generation, name of the file, and full relative path.

For example, in a .md file:

---
title: My first great blog article
author: Vuzi
abstract: This is my first article !
tags:
  - Blogging
  - Hacker
  - Test
---
# Introduction
Hello

Will result in the local template file to be called with the following metadata:

{
  "filePath": "foo/bar/stuff.md",
  "fileName": "stuff.md",
  "now": "2021-05-23T10:26:00.996Z",
  "title": "My first great blog article",
  "author": "Vuzi",
  "abstract": "This is my first article !",
  "tags": [ "Blogging", "Hacker", "Test" ],
  "content": // HTML from the markdown
}

Templating

Markdown and yaml require a template to be rendered. Liquid files can also be used along a template. A template is a special file name _template.liquid that will be applied to the directory it is defined in.

The template can be used along the metadata defined previously :

<article>

  <header>
    <h1>{{ metadata.title }}</h1>

    <span>
      By {{ metadata.author }}
    </span>

  </header>

  {{ content }}

</article>

Passing metadata upward

Metadata will bubble up from every file generated, allowing to create links and use that information dynamically:

posts/post.liquid

---
title: My first great blog article
abstract: This is an article
---
[... content]

index.liquid

  <div>
    <ul>
    {%- for postKeyValue in posts -%}
      {% assign post = postKeyValue[1] %}
      <li>
        <h2>{{ post.title }}</h2>
        <p>{{ post.abstract }}</p>
        <a href="{{ post.filePath }}" >Click here</a>
      </li>
    {%- endfor -%}
    </ul>
  <div>

Command line arguments

$ mrHyde scan -h

Scan the source folder

Positionals:
  dir  Directory to scan                               [required] [default: "."]

Options:
  -v, --version    Show version number                                 [boolean]
  -h, --help       Show help                                           [boolean]
      --templtate  Template file          [string] [default: "_template.liquid"]
$ mrHyde run -h

Run the static website generator

Positionals:
  dir  Directory to scan                                     [string] [required]
  out  Output directory                              [string] [default: "./out"]

Options:
  -v, --verbose   Run with verbose logging            [boolean] [default: false]
      --version   Show version number                                  [boolean]
  -h, --help      Show help                                            [boolean]
      --template  Template file           [string] [default: "_template.liquid"]
      --asset     Asset directory                   [string] [default: "assets"]
  -e, --erase     Erase the output before generation  [boolean] [default: false]
  -w, --watch     Run in watch mode                   [boolean] [default: false]
  
$ mrHyde dev -h

Run the static website generator in watch mode and expose the result

Positionals:
  dir  Directory to scan                                     [string] [required]
  out  Output directory                              [string] [default: "./out"]

Options:
  -v, --verbose   Run with verbose logging            [boolean] [default: false]
      --version   Show version number                                  [boolean]
  -h, --help      Show help                                            [boolean]
      --template  Template file           [string] [default: "_template.liquid"]
      --asset     Asset directory                   [string] [default: "assets"]
  -e, --erase     Erase the output before generation  [boolean] [default: false]
      --host      Web server host                [string] [default: "localhost"]
  -p, --port      Web server port                         [number] [default: 80]