Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add development instructions #43

Merged
merged 4 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,28 @@ An open source web-based comic book reader.
$ yarn add villain-react
```

## Development

- Run `yarn install` in the console
btzr-io marked this conversation as resolved.
Show resolved Hide resolved
- An example archive has been provided to play around with in `/build/testFiles`.
- To replace it with another file, in `/examples/index.js` modify the path of `testFile2` to equal `'/build/testFile/newFilename.extension'`.
- A good resource for archives can be found here: https://archive.org/details/comics. Alternative, any compressed folder (zip, rar, tar, etc) with a few images will also do the job.
- Running `yarn start` will open up `localhost:8080` on your default browser

## WebWorker

This component uses the [libarchivejs](https://github.com/nika-begiashvili/libarchivejs) for the extraction process,
so you will need to provide the path of `webworker`:

> The webworker bundle lives in libarchive.js/dist folder so you need to make sure that it is available in your public folder since it will not get bundled if you're using bundler (it's all bundled up already)


```JSX
const opts = {
workerPath: 'path to ../build/worker-bundle.js',
...
}
```

## Usage

Import the component and the css styles
Expand All @@ -63,13 +71,14 @@ const url = '/files/test.cbz'

Available options to customize the reader component:

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| workerPath | string | null | path to libarchive.js `worker-bundle`. |
| allowFullScreen | bool | true | Show full screen button. |
| autoHideControls | bool | true | Auto hide and show toolbar on `hover`, `focus` or `blur` events. |
| Name | Type | Default | Description |
| ---------------- | ------ | ------- | ---------------------------------------------------------------- |
| workerPath | string | null | path to libarchive.js `worker-bundle`. |
| allowFullScreen | bool | true | Show full screen button. |
| autoHideControls | bool | true | Auto hide and show toolbar on `hover`, `focus` or `blur` events. |

## Credits

- :hammer_and_wrench: Created and maintained by [@btzr-io](https://github.com/btzr-io) with the help of some awesome [contributors](https://github.com/btzr-io/Villain/graphs/contributors).

- :art: Logo and artworks designed by [@btzr-io](https://github.com/btzr-io), see [license](https://github.com/btzr-io/Villain/blob/master/ARTWORKS_LICENSE.md).
Binary file added build/testFiles/Example-archive.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const villainOpts = {
}

const testFile = '/build/test_files/archive.cbz'
btzr-io marked this conversation as resolved.
Show resolved Hide resolved
const testFile2 = '/build/test_files/test.cbz'
const testFile2 = '/build/testFiles/Example-archive.zip'
btzr-io marked this conversation as resolved.
Show resolved Hide resolved

ReactDOM.render(
<div>
Expand Down