Skip to content

Commit

Permalink
README: some clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Sep 8, 2022
1 parent 4f5e521 commit 76cd057
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Create a new directory for your project.

Create the necessary files for an OpenFL project, including _project.xml_ and _.hx_ source files inside the project's root directory. Then, follow the remaining steps to setup Webpack and openfl-loader.

Run the following command to create a _package.json_ file:
In a terminal, run the following command in the root of your project to create a _package.json_ file:

```sh
npm init -y
```

Run the following command to install the required dependencies:
Then, run the following command to install the required dependencies:

```sh
npm install --save-dev webpack-cli webpack-dev-server openfl-loader
Expand All @@ -35,7 +35,8 @@ Create a _webpack.config.js_ file in the root of your project:
module.exports = {
entry: "./project.xml",
output: {
filename: "bundle.js",
// change xyz to an appropriate name for your project
filename: "xyz.bundle.js",
},
module: {
rules: [
Expand All @@ -54,6 +55,27 @@ module.exports = {

Create a _public/index.html_ file. Look inside _samples/basic_ sample for an example that's easy to copy with minor modifications.

In particular, you need to change the _basic.bundle.js_ path to the same output file name used in _webpack.config.js_:

```html
<!--
This bundle file name is defined in webpack.config.js
-->
<script src="./basic.bundle.js"></script>
```

And you need to change the `lime.embed()` call to pass the same app file name used in _project.xml_.

```js
/*
the first argument passed to lime.embed() is the
<app file="******"/> value from project.xml
*/
lime.embed("WebpackBasicSample", "openfl-content", 0, 0, {
parameters: {},
});
```

To start a local development server, run the following command. Then, open _http://localhost:8080/_ in a web browser.

```sh
Expand Down

0 comments on commit 76cd057

Please sign in to comment.