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

added section for running from local dev server #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,33 @@ Install `@teipublisher/pb-components` into your project:
npm install --save @teipublisher/pb-components
```

## Loading from a local devserver

Notice: requires a TEI-publisher/master after 04.09.2020


For development and debugging purposes it's sometimes useful to run a local copy of the
components from a local devserver. The devserver is already present in the pb-components project and
can be run via npm.

In order for your TEI-Publisher app to know form where to load the components you have to adapt `modules/config.xqm`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

form -> from

* look for the variable `$config:webcomponents-cdn` and set it to `http://localhost:8000`
* look for variable `$config:webcomponents` and set it to "dev";

For the full process:
* fork or clone this repository to your local disk
* make sure you have npm installed
* make sure you've made the above settings
* run 'npm i` to install dependencies
* run `npm run start` to start the devserver on http://localhost:8000

### Browser plugins for CORS

When you work from within TEI-Publisher and requests components from dev-server you will run into CORS issues. There are browser plugins (and maybe others) to disable CORS for your development.

For instance:
https://mybrowseraddon.com/access-control-allow-origin.html

## Extending

If you wish to extend the library with your own components, there's a [template project](https://github.com/eeditiones/pb-extension-template) available, which you may fork.
Expand Down