Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Offline support - #5

Merged
aendra-rininsland merged 16 commits into
masterfrom
offline-support
Feb 4, 2019
Merged

aendra-rininsland merged 16 commits into
masterfrom
offline-support

Conversation

@aendra-rininsland

Copy link
Copy Markdown
Member

This is a first pass at offering offline support.

The idea with Visual Vocabulary Templates is you copy the "offline" folder into your project and change the line in index.html from:

<script src="//unpkg.com/@financial-times/d3-bootloader" async></script>

to

<script src="./offline/index.js" async></script>

@aendra-rininsland

Copy link
Copy Markdown
Member Author

I've added a tool to d3-bootloader that provides this support when you install d3-bootloader globally.

@aendra-rininsland

aendra-rininsland commented Dec 11, 2018 •

Copy link
Copy Markdown
Member Author

Update:

The preferred way to use this is now:

npx @financial-times/d3-bootloader

... In any project directory. This will:

  1. Get a tarball of the relevant version of d3-bootloader via npm
  2. Extract it to $CWD/offline
  3. Rewrite the script tag in index.html to point at the new offline version of d3-bootloader.

This all should be added to the README.

Comment thread get-offline.js
@@ -0,0 +1,44 @@
/**

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this file called?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tlfrd It's set as bin.offline in package.json so users can either install @financial-times/d3-bootloader globally or run npx @financial-times/d3-bootloader and it will:

  1. Download all dependencies for offline use to the local directory
  2. Rewrite the d3-bootloader script tag to use the offline version.

aendra-rininsland pushed a commit to ft-interactive/visual-vocabulary-templates that referenced this pull request Dec 12, 2018
Comment thread package.json Resolved
Comment thread bin/go-offline.js Outdated
console.info("Using `latest` release dependencies.");
}

const downloadUrl = `https://api.github.com/repos/ft-interactive/d3-bootloader/tarball/${version}`;

@joannaskao joannaskao Dec 19, 2018 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does downloadUrl get used anywhere?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! Removed.

@aendra-rininsland
aendra-rininsland merged commit 24287d5 into master Feb 4, 2019
@aendra-rininsland
aendra-rininsland deleted the offline-support branch February 4, 2019 17:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants