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

smithsonian

v3.0.1

Published

web interface for Metalsmith

Downloads

13

Readme

Smithsonian

Smithsonian is a web interface for Metalsmith. If you are already using Metalsmith, adopting Smithsonian could not be easier. Smithsonian extends Metalsmith so the exact same plugin/middleware system works, just swap out Metalsmith for Smithsonian.

Metalsmith = require('metalsmith');
Metalsmith(__dirname)
  .use(markdown())
  .use(templates('handlebars'))
  .build();

..becomes..

Smithsonian = require('smithsonian');
Smithsonian(__dirname)
  .use(markdown())
  .use(templates('handlebars'))
  .build() // still builds as expected
  .listen(8080); // listening on localhost:8080

Note: Smithsonian calls build() internally when listen() is called.

New in Version 3

The third version of Smithsonian brings huge underlying changes with only minor developer facing changes. The most important change is that Smithsonian's file access API is now completely decoupled from the user interface. This means that a custom interface can be used instead. This eliminates the need for the old configuration options. And although now decoupled, the default user interface Standard has been completely visually overhauled and has a lot more features.

To upgrade from v2 to v3, add the web interface to your Express application, like how the Smithsonian API router is added using express.use(). Note: this is only necessary if Smithsonian is nested inside another application.

Installation

npm install smithsonian

Usage

Smithsonian can be used as an Express application or as an Express middleware and router inside of an existing Express application. Smithsonian is designed to be completely detached from the rest of the application so there are no side-effects to incorporating Smithsonian into a project.

Express Server

var Smithsonian = require('smithsonian');
Smithsonian(__dirname).listen(3000);

Express Router

var express = require('express'),
    Smithsonian = require('smithsonian');

express()
    .use('/subdirectory', Smithsonian(__dirname).router())
    .listen(3000);

Smithsonian Standard

express()
  .use('/smithsonian', require('smithsonian/standard')(API_URL))
  .listen(3000);
// where API_URL is wherever the Smithsonian router is mounted.

Use Cases

Smithsonian is really just a basic file explorer that only works with a Metalsmith source directory. It does not serve the built files; use http-server for that. Smithsonian is really useful for remote deploys and as an administration interface. Smithsonian is like an extremely minimal CMS, but for Metalsmith.

Say you have Metalsmith building static content behind Nginx. Expose Smithsonian (preferably backed by forever) in the Nginx config and you now have an easily accessible administration tool to create, edit, and delete source files. No need to build locally and deploy with git or any other manual tool.

Building a simple blog for a company/client? If they can manage plain text, Smithsonian is good enough to hand off to clients.

Methods

Smithsonian only exposes the plugin system of Metalsmith, which are only #use() and #build(). All other methods calls outside of Metalsmith plugins will need to use Smithsonian.metalsmith which is Smithsonian's Metalsmith instance.

Smithsonian also exposes #listen() which will start the web server that serves the interface and #router() which returns the Express router middleware.

Smithsonian Standard

Smithsonian comes with a default web interface called Standard. If a custom design is needed, Smithsonian is completely decoupled from the underlying API.

List View File View

Fin

Thanks for using Smithsonian. Or for at least reading this far down into the README.

Follow me on Twitter for updates or just for the lolz and please check out my other repositories if I have earned it. I thank you for reading.