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

yo-static

v1.2.0

Published

Yo-yo static isomorphic site generator

Downloads

9

Readme

yo-static

stability travis npm version js-standard-style

yo-yo single-page website and isomorphic static site generator

yo-static is a tiny library (11.1kb minified and gzipped) that helps you build a fast, single-page website. It also generates a static version of the site that you can upload to Github Pages or Amazon S3 so you get fast loading pages and search engine SEO without needing to maintain a server. Whatever page you enter the site, from there it acts as a single-page app.

yo-static uses the excellent yo-yo library under the hood, and recommends you do too, but it doesn't really care what you use. Pages and Layouts are just javascript functions that should return a DOM element that will be rendered into document.body.

Content pages are markdown, with YAML Front Matter. Markdown is rendered as html and passed as a parameter to the layout functions.

yo-static is inspired by @shama's website dontkry.com and borrows a lot of ideas from jekyll.

Needs some docs! For now check digidem/digital-democracy.org/tree/yo-yo (also WIP)

Table of Contents

Install

npm i -g yo-static

Usage

Create pages by creating javascript files in a _pages folder. They must export a function that will receive a props argument and must return a DOM element that will be rendered to the page body.

var yo = require('yo-yo')
var layout = require('./default-layout')

module.exports = function renderIndex (props) {
  return layout({},
    yo`<div>
      <h1>Welcome to Yo-Static</h1>
      <p>Create an <code>index.js</code> file in <code>${props.site.pages_dir}</code>
      and add some markdown files to <code>${props.site.content_dir}</code> to get started</p>`
  )
}

Create content by creating markdown files in a _content folder. You can define a layout in YAML front matter or a default layout will be used.

Create layouts as javascript files in a _layouts, the content will be available as the second argument:

var yo = require('yo-yo')

module.exports = function defaultLayout (props, children) {
  return yo`<body>
    ${children}
  </body>`
}

To serve a site locally for development:

yo-static serve

To build a site for deployment:

yo-static build

Your site will be in _site

Development Status

This is experimental. As we figure out the best API, things might change and things might break (we don't have good test coverage yet, but would welcome contributions).

Contribute

PRs accepted.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Gregor MacLennan