@readium-js/cfi
Version:
Readium - CFI javascript library
87 lines (50 loc) • 1.82 kB
Markdown
# Readium JS - CFI
**EPUB3 CFI utility library in JavaScript**
## Installation
### Using npm / yarn
`npm install @readium-js/cfi`
or
`yarn add @readium-js/cfi`
### Importing
**This library is bundled in UMD and ES module formats.**
- CommonJS
```javascript
const EPUBcfi = require('@readium-js/cfi');
```
- ES Modules
```javascript
import * as EPUBcfi from '@readium-js/cfi';
```
- Globally with `window.EPUBcfi`
```html
<script src="readium-js-cfi.umd.js"></script>
```
## 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:**
- Node JS
**Initial setup:**
* `npm install`
**Typical workflow:**
* Hack away! (mostly the source code in `./src` and `./test/specs` )
* `npm run build` (to update the output bundles in the `dist` folder)
**Unit tests:**
* `npm run test`
## Bundled outputs
The `dist` directory contains bundled scripts in two module formats:
### UMD - [Universal Module Definition](https://github.com/umdjs/umd)
`readium-js-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-js-cfi.esm.js` (and its associated source-map file),
also aggregates all the required code
Works best for _rollup.js_ or _webpack_
## NPM package
NPM packages "owned" and maintained by the Readium Foundation are listed here: https://www.npmjs.com/~readium-js
## License
**BSD-3-Clause** ( http://opensource.org/licenses/BSD-3-Clause )
See [LICENSE](./LICENSE).