Skip to content

Commit

Permalink
Allow directory list to be a string
Browse files Browse the repository at this point in the history
  • Loading branch information
leo committed May 23, 2017
1 parent d10b703 commit ae5ff6b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 12 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ const adjustRenderer = (protocol, dir) => {
})
}

module.exports = async (electron, dir, port) => {
module.exports = async (electron, dirs, port) => {
const directories = {}

if (typeof dirs === 'string') {
directories.prod = dirs
directories.dev = dirs
} else {
directories = dirs
}

if (!isDev) {
adjustRenderer(electron.protocol, dir)
adjustRenderer(electron.protocol, dirs.prod)
return
}

await devServer(electron.app, dir, port)
await devServer(electron.app, dirs.dev, port)
}
7 changes: 6 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ npm install --save electron-next
Then load it:

```js
const electron = require('electron')
const prepareNext = require('electron-next')
const { resolve } = require('app-root-path')
```

And finally use it to prepare your application before you create and `BrowserWindow`s:

```js
await prepareNext(electron)
await prepareNext(electron, {
dev: resolve('./renderer/out'),
prod: resolve('./renderer')
})
```

## Caught a Bug?
Expand Down

0 comments on commit ae5ff6b

Please sign in to comment.