Skip to content

Generate static site pages after JavaScript has run  #15639

Open
@henare

Description

Problem

We currently have one page that uses JavaScript to progressively enhance the page by displaying up-to-date data from a remote API. It first gets the data from the GitHub API using Ruby, which is what the static site then shows on the published site. When a user visits the page the JS will also run and fetch the most up to date data from the API.

A problem with this is that the logic to get this data exists in Ruby and JS. If our static site generator ran after JS was executed we'd be able to remove the Ruby code that fetches this data, reducing the amount of code we need to maintain. Because the static site had been generated with the data included, the user experience would be the same as it currently is.

This duplication isn't a problem for one page but as part of the Democratic Commons project we're about to start using JS to pull in a lot more data from Wikidata so it makes this change a worthwhile thing to do.

Proposed Solution

From everypolitician/democratic-commons-tasks#36 (comment)

...switch to crawling these pages with Capybara / PhantomJS...

Acceptance Criteria

The static Countries Needed page is generated populated with data, but without using the Ruby code that currently populates data for it from the GitHub API.

Related Issues

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions