Skip to content
Edward Silverton edited this page Oct 26, 2018 · 34 revisions

Deploying

Here is an example project to help you understand how to deploy the UV: https://github.com/UniversalViewer/uv-app-starter/blob/gh-pages/index.html

You can see a few dependencies being included:

  • uv/uv.css is just some simple styles for the div containing your UV instance to give it a black background with a "spinner".

  • uv/lib/offline.js is all of these dependencies concatenated (jQuery, CoreJS, and JSViews) You could use a CDN for these instead if you prefer. It's called 'offline' because it allows the UV to work using protocols like IPFS where you're loading everything over a different network to the web.

  • uv/helpers.js wraps up some boilerplate code for managing resizing, full screen, and UV event listeners/handlers.

  • uv/uv.js is the compiled UV code, in debug or distribution context depending on if grunt build or grunt build --dist were used respectively. Include this script at the bottom of your page to avoid problems around the uvLoaded event being fired too early.

All of these scripts are copied into your examples/uv folder on build.

Config

The UV's visual config editor has not been ported for v3 yet.

  • root: string

    The path to the uv directory. Use a relative path e.g. root: '../../uv'

  • configUri: string

    The relative path to your config json

Metrics

The UV has css media queries that respond to the width of the containing page. These are partitioned into four separate "metrics" which are defined both in css and js, so that they can be queried programmatically at runtime:

https://github.com/UniversalViewer/universalviewer/blob/master/src/modules/uv-shared-module/css/variables.less#L7 https://github.com/UniversalViewer/universalviewer/blob/master/src/extensions/uv-seadragon-extension/config/en-GB.json#L12

Distribution

Ensure you have git tagging on version disabled:

npm config set git-tag-version=false

In universalviewer

grunt build --dist
npm version major/minor/patch 

(info.json is created in /dist with the new version number) This only works on Windows at present. But you can change the npm script to use $npm_package_version instead of %npm_package_version%

npm publish --tag beta

cd examples

git add -A
git commit -m "build"
git push origin gh-pages

Gotchas

UV not appearing in IE

If you have another file called uv.js it can result in this bug: https://github.com/requirejs/requirejs/issues/518