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

pjax-pwa-overlay

v0.2.3

Published

A set of mustache templates to be used with express-mustache-overlays and bootstrap-flexbox-overlay that add PJAX (PushState+AJAX) and Progressive Web App support to a project.

Downloads

5

Readme

PJAX PWA Overlay

A set of mustache templates to be used with express-mustache-overlays and bootstrap-flexbox-overlay that add PJAX (PushState+AJAX) and Progressive Web App support to a project.

Configuration

The components in this package make use of the app.locals.pjaxPwa namespace.

Example

See ./example for a full example and tutorial.

Environment Variables

All the environment variables from express-render-error, express-mustache-overlays and express-public-files-overlays are available in the example, but the following are also available from bootstrapOptionsFromEnv():

  • NETWORK_ERROR_URL - the URL the PWA should fetch to use in case there is a network error in future
  • START_URL - the URL the PWA should fetch to use each time the site is opened (after the user has installed the app)
  • WITH_PJAX_PWA - enable or disable the PJAX PWA support, defaults to 'true', set to 'false' to disable PWA support
  • WITH_START_PAGE - setup a route handler at the startUrl that renders the template start to generate the start page. Defaults to true.
  • WITH_NETWORK_ERROR_PAGE - setup a route handler at the networkErrorUrl that renders the template networkError to generate the network error page. Defaults to true.
  • START_PAGE_TITLE - The title of the start page. Defaults to 'Start'.
  • NETWORK_ERROR_PAGE_TITLE - The title of the network error page. Defaults to 'Network Error'

PJAX Links and Forms

All links within <div id="pjax-container"> will automatically use PJAX (as long as you have WITH_PJAX_PWA='true' set).

Any form given the ID data-pjax will be submitted as multipart via PJAX too. Only one form per page can have this ID though. The express-mustache-jwt-signin package's sign in form already has this ID for example.

Since forms are submitted as multipart, you'll need to install middleware that can parse that and make it available as req.body. For example busboy.

Tip: Debugging PJAX requests can be tricky because the default behaviour if there is an error is to re-fetch and re-load the entire page. To be able to track down errors more easily in your browser, make sure you tick the Preserve Log checkbox in the network tab and console so that you can see the failed request as well as the successfull request afterwards.

Dev

npm run fix

Changelog

0.2.3 2019-02-15

  • Changed setupPjaxPwa() so that withPjaxPwa defaults to true
  • Added withStartPage and withNetworkErrorPage with default values of true to the config options you can pass to setupPjaxPwa()
  • Added NETWORK_ERROR_PAGE_TITLE and START_PAGE_TITLE
  • Added default config options

0.2.1 2019-02-15

  • Changed setupPjaxPwa() so that any config specified overrides the values in app.locals.theme and app.locals.pjaxPwa for the purposes of setting up the PJAX PWA
  • Updated the example so that it caches the public files it needs using service worker

0.2.0 2019-02-15

  • Make WITH_PJAX_PWA true by default
  • Provide deafault icon192 URL and icon

0.1.0 2019-02-06

  • First version