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

balrog

v1.0.2

Published

static site generator

Downloads

18

Readme

Hi!

Disclaimer: One, this documentation is out of date, two, I've made this for my own purposes so it's very suited to that, it likely won't work, out of the box, just like you want it to, or be very adaptable. But! Have a look if ya want, fork and change it all up!

balrog

A static site generator with these goals:

  • Written in the pure, classic and elegant language JavaScript, using Node.js.
  • Use Handlebars for templating.
  • Includes paginated post feed!
  • RSS
  • Less mattery front-matter. Meta data extracted from post headings allowing markdown files to be free from traditional front-matter.

File Structure

|_BlogFolder
  |_partials (optional)
    -pagination.html (optional)
    -header.html
    -footer.html
  |_templates
    -page.html
    -blog.html
    -feed.html
  |_content (required)
    |_assets (optional)
      |_css
      |_js
      |_img
    |_blog
      -blog-post.md
      -moar-post.md
    |_about.md

Options

opts = {
  source: "./content",
  output: "./site",
  templateDir: "./templates",
  partialsDir: "./partials",
  pagination: 4,
  templates: {
    blog: 'blog/*',
    about: 'about.md',
    feed: 'page/*'
  },
  feed: {
    postsDir: './content/blog',
    urlPrefix: 'blog',
    site: {
      url: 'http://example.org',
      title: 'My Site',
      description: 'A site for stuff, ya know?',
      imageUrl: 'http://example.org/image.png',
      author: 'meauthor',
    }
  }
}
  • source, output, templateDir are the locations for the starting content, templates and your build.
  • partialsDir is optional and is for Handlebars template partials
  • templates is an object designating what templates to use on what pages. You can list directories or individual files in an array.
  • pagination is how many posts per page to show on post feed pages. If you don't include this, it defaults to 5.
  • feed is not optional, you must provide this information for generating the RSS

To Build

  1. Requires Node.js and NPM (which comes with .pkg and .msi downloads of Node.js)
  2. You'll install the balrog module globally, then run it from the command line within a directory set up in the style diagramed above.

Install Balrog

npm install -g balrog

Build Your Content

  1. Set up file structure as described above
  1. Create config.JSON
  2. Make sure you include and use the following as described:

Blog Feed Template

When creating a blog feed page template (the one that shows x (pagination number) of posts per page), your template must look like this:

{{#posts}}
  {{{content.content}}}
{{/posts}}
{{> pagination}}

Pagination Template

The "Previous/Next" links are added to the bottom of blog feeds via a Handlebars Partial template:

<div class="turn-page">
  <a class="turn-previous" href="{{previous}}">Previous</a>
  <a class="turn-next" href="{{next}}">Next</a>
</div>

Additionally, the class end-of-pages is applied when there is not a previous or next page. If you do not include a partials directory, it will default to generating 1 blog post feed page with all posts.

Posts, Meta Data

Meta data is generated through the first 4 lines of each blog post. It doesn't matter how you style them, so long as your first 4 lines are in this order:

# Title
### Author
#### Date
##### Tags, tags, tags

Hi this is a post. So pancake.

Build!

From within your soon-to-be Balrog'd directory, run:

  • balrog

Build & Serve Locally & Watch

Serve up the site locally on a random port and watch for changes:

  • balrog -serve -w

Host on GitHub Pages

Create a new repository on GitHub and place all the contents of your Balrog generated /site directory on a branch named gh-pages. Bam, website! You can find it at: yourgithubname.github.io/reponame