readium / readium-cfi-js

BSD 3-Clause "New" or "Revised" License
43 stars 45 forks source link
cfi epub javascript

readium-cfi-js

EPUB3 CFI utility library in JavaScript

This is a software component used by other Readium projects, see https://github.com/readium/readium-shared-js

License

BSD-3-Clause ( http://opensource.org/licenses/BSD-3-Clause )

See license.txt.

Installation

Using npm / yarn

npm install readium-cfi-js or yarn add readium-cfi-js

Importing

This library is bundled in UMD and ES module formats.

Usage in non-browser environments (Node)

Currently not supported as the implementation depends on jQuery and the DOM.

A subset of the API could work without a browser, which may be planned for a future release.

Development

Prerequisites:

Initial setup:

Typical workflow:

Unit tests:

Travis (Continuous Integration): https://travis-ci.org/readium/readium-cfi-js/

Bundled outputs

The dist directory contains bundled scripts in two module formats:

UMD - Universal Module Definition

readium-cfi.umd.js (and its associated source-map file), which aggregates all the required code (external library dependencies included, such as jQuery, etc.)

You can include this as CommonJS/AMD or with the global EPUBcfi

Works best for when using Browserify or RequireJS

ES Modules

readium-cfi.esm.js (and its associated source-map file), also aggregates all the required code

Works best for rollup.js or webpack

NPM package

All packages "owned" and maintained by the Readium Foundation are listed here: https://www.npmjs.com/~readium