Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Usage with parcel #197

Open
wants to merge 4 commits 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
40 changes: 39 additions & 1 deletion website/docs/guide/use-with-bundlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,43 @@ You may need to use [html-webpack-plugin](https://github.com/jantimon/html-webpa
If you're using [Vue CLI](https://cli.vuejs.org) or [Poi](https://poi.js.org), congratulations, there's no more build configs needed.

## Parcel
You need a basic html file as entry-point. Let this be `index.html`:

[TODO] [PR WELCOME]
```html
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>My Docs</title>
</head>
<body>
<div id="docute"></div>
<script src="index.js"></script>
</body>
</html>
```

To bundle Docute simply add the following to any imported or required js-file. (Here it would be `index.js`):

```js
import Docute from 'docute'

new Docute({
target: '#app',
// Other options
sourcePath: "<sourcePath>"
})
```

If you use an full url as [sourcePath](https://docute.org/options#sourcepath) you are done.

If you want to use a local local files you have to [modify your build command](https://github.com/parcel-bundler/parcel/issues/1411#issuecomment-415483965).

```json5
{
"scripts":
{
"build": "cp -R <sourcePath> ./dist && parcel build index.html"
}
}
```