Coder Social home page Coder Social logo

sphinxext-pwa's Introduction

sphinxext-pwa

๐Ÿ›‘ STOP ๐Ÿ›‘

This technology is highly experimental and volatile. Individuals using this extension should expect the following:

  • completely random breakage
  • excessive data usage
  • excessive battery life drain
  • completely breaking your sphinx website

Current Issues

  • iOS is only partially working
    • For some weird reason, the service worker is getting killed and not being reactivated consistently.

See issues for more information.

Introduction

Progressive Web Applications, also known as PWAs, are a fantastic technology that enables seemless integration between websites and mobile devices. It empowers websites with the ability to present itself as a native-style application; complete with notifications and offline support. This extension's goal is to provide a "close as possible" integration between Sphinx and PWAs.

Installation

Installation is pretty easy but has a couple major points.

First, you need to add this dependency to your extensions list in conf.py.

extensions = [
    "sphinxext.pwa",
]

The extension will automatically prepopulate data for the manifest that is required for PWAs. However, setting the icons is mandatory. pwa_icons is a configuration variable that accepts a list of arrays. The nested array must have index 0 be the directory of the icon. The second 1 index must be string list of sizes of that icon.

IMPORTANT: Icons must be placed at the root of the _static directory. Subdirectories will not work.

pwa_icons = [["_static/myicon.webp", "48x48"]]

This extension does require NodeJS >= 16. If you are deploying on ReadTheDocs, you need to add or customize the build config as shown here. Once this is done, that should be all that is required to turn your Sphinx website into a Progressive Web Application!

Configuration

PWAs have a lot of configuration. For details on accepted inputs, see the Mozilla documentation. Only a limited subset of options are exposed. Below are a list of exposed manifest options.

Note: Invalid inputs to these options can break the PWA and be extremely difficult to debug.

Configuration Default Type
pwa_name project variable in conf.py String
pwa_short_name None String
pwa_theme_color None String containing HEX color code
pwa_display "standalone" String
pwa_icons MANDATORY [["image location", "sizes"]]
pwa_online_only False Boolean

Caveats

Supported Browsers: Chrome (Desktop & Mobile), Firefox (Mobile), Safari (iOS). Only the standard, non-beta, non-light versions of these browsers are supported.

Supported OSes: Android >= 6. iOS >= 14.2

Installation Time for Offline to Work: It depends on the website, but a 160MB application takes on average 15 minutes to enable offline support. This also changes depending on the device specific implementation.

Cache Timeouts: Whenever the user clears their browser cache, it will purge the assets. It is undetermined at this time if it will retrigger the download of the entire cache. Some users have space saving applications that may interfere with this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.