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

generator-infinitely-static

v2.1.1

Published

Static page generator with routes support thats infinitely awesome

Downloads

12

Readme

infinitely-static

This is a static page generator with basic support for routing. The idea behind this tool is to streamline development of static webpages with the best of Webpack and related tools.

What is included?

  • Linting tools with sane defaults - stylelint and eslint
  • Hot reloading in development
  • Babel with env preset activated that takes care of polyfills, as well
  • JavaScript minification and dead code removal
  • SASS compilation, prefixing, and minification
  • A library for managing media breakpoints (media-blender)
  • Handlebars as a templating language (with helpers, layouts, and partials)
  • Support for routes (flat and nested build structure)

Getting started

Running this is really simple. You'll need this generator and yo installed.

npm install -g yo generator-infinitely-static
mkdir my-project
cd my-project
git init
yo infinitely-static

Note: After the project is initialized run npm install husky --save-dev.

Development

When Yeoman finishes you have a working project.

Running hot reload server

npm start

Production build

npm run build

Routes

Adding routes is also simple. In the root of the project you will find routes.json, containing the initial index route. The route configuration also supports nesting and template data.

{
  "index": { // points to the template file in app/templates/pages/index.hbs
    "route": "/", // don't forget the trailing slash
    "context": { // data that you can use in the page
      "user": {
        "name": "Super user"
      }
    }
  },
  "contact": {
    "route": "contact/me/" // will generate nested routes
    }
  }
}

Afterwards, in your templates you can use the included {{linkTo}} helper like this:

<a href="{{linkTo 'index'}}">Home</a>

And for the user data you can use the getDataAsString helper:

<h1>{{getDataAsString 'user.name'}}</h1>

If the data is simple (array, string, Number, etc.) it will be shown as usual, but if you reference an object you'll get a stringified JSON. But, remember, the data can be accessed directly by using the htmlWebpackPlugin.options object in the template:

<h1>{{htmlWebpackPlugin.options.context.user.name}}</h1>

That way you can iterate thru an array specified in the context using the build-in helpers.

License

The MIT License

© 2016 Infinum Inc.