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

@amoutonbrady/sbg

v0.1.2

Published

CLI to make the easiest static blogs

Downloads

7

Readme

Static Blog Generator

Minimal, experimental & opinionated static blog generator

PWA score 100%

Usage

Add sbg to your local dependencies

yarn add @amoutonbrady/sbg

When you are ready to build your thing just run teh following command from thr root of your project

yarn sbg or npx sbg

You can also create an npm script that runs it for you

// package.json
{
	...,
	"scripts": {
		"build": "sbg"
	}
}

And run yarn build or npm run build


The build will automatically create a dist folder with everything routed for a static host.

Additionnally, it will also provide a service worker to make the website work offline and please the search engine with an okay-ish Lighthouse score.

Architecture

├───assets
├───layouts
├───pages
└───posts
  • assets: contains all the images (we don't care about CSS or JS)
  • layouts: contains the layouts, see the different layouts below
  • pages: each html file will represent a page (eg: blog.html will turn into /blog/index.html). The posts param will be auto-injected
  • posts: contains your posts content. The title of the file will be the slug

Layouts

All layout file have to be in the layouts folder.

Layouts are just nunjucks templates. You can extends and do all sort of things with it.

Any data defined in the front matter markdown files will be injected in the corresponding layout. First it will be be parsed by gray-matter, then compiled to html via marked. All code will be automatically highlighted by shiki.

The content variable is the compiled markdown.

List of supported template files:

| Name | Available variables | | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | post.html | _ content: markdown content as html_ createdAt: creation date (js date) of the markdown file_ updatedAt: last modified date (js date) of the markdown file_ url: relative url of the blog post* Any other data defined in the front matter of the markdown file |

More to come as the project needs it.

Pages

List of variables injected into each page:

  • posts: List of posts which an array of object containing the same data as the post.html template minus the content one.

Config

If a config.js is at the root of the directory, it will be resolved and used.

Its needs to default export a configuration object.

For the moment only the filters key work. It is an array of filters for njk templates.

TODO

Initial TODOS

  • [x] ~~Moare layouts (specifically index with list of posts)~~ Implemented as "pages"
  • [x] ~~Process assets~~ Only for JS (minification) & CSS (dead code removal, minification, autoprefixer, tailwind)
  • [ ] ~~Mess around with typescript maybe~~ Delayed for later
  • [x] ~~Make it agnostic and configurable maybe~~ Sort of implemented it (only njk filters for now)
  • [x] ~~Add feedback on the CLI~~ Added some more context during build
  • [x] ~~Add a develop mode maybe~~ Add a "serve" command to serve the dist, still to build manually for now

02/25/2020

  • [ ] Inject a pages variable in the pages files to be able to make a navigation
  • [ ] Add a filter or something to make some sort of pagination
  • [ ] Fix perfs issues if possible...
  • [ ] Mess around with typescript maybe, could be useful for the config