0.2.1 • Published 6 years ago

@determapp/viewer v0.2.1

Weekly downloads
-
License
GPL-3.0
Repository
gitlab
Last release
6 years ago

DetermApp Viewer

This contains the viewer for DetermApp content as prebuilt archive. It should be put into the same directory as the content for working.

API

import { urlBlacklist, render, viewerArchivePath } from '@determapp/viewer';

// urlBlacklist contains the URLs which the editor uses itself/ which can not be used by generated HTML files as an Array<string>

// render allows rendering an page as html string
const page = render({
  type: 'result' | 'question',
  id: 'id of result or question',
  url: 'id of the item',
  data: project // project should be a Project (from @determapp/viewer-data)
});

// viewerArchivePath contains the path of the bundled viewer.tar.gz as string

Bundling

When you use this package and want to bundle your application (e.g. with Webpack):

  • configure __dirname to match the path of the running script
  • copy determapp-viewer.tar.gz to the directory of the output directory.
    • you can get the path of the file with require('@determapp/viewer').viewerArchivePath

Commands

npm run build

  • builds this component
  • executed as prepare hook

npm run serve

  • starts the viewer in developmennt mode
  • assumes an export at ../../determapp-content/export/schmetterlinge