Skip to content

Commit

Permalink
readme: general updates
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Oct 20, 2018
1 parent 0b9892a commit eb7d3c3
Showing 1 changed file with 58 additions and 6 deletions.
64 changes: 58 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,50 @@
To enable easy usage, `config-gen` is packaged as a single binary (currently only osx) - just check
the [releases](https://github.com/shakyShane/config-gen/releases) page and download the latest version.

## Step 2 - create a configuration file, call it `config-gen.yml`
To make it executable, run

```sh
chmod +x config-gen
```

**Note**: Some easier installation methods will be released in the coming weeks. :)

## Step 2 - create a configuration file (either `json` or `yaml`)

You can name it anything, but for example, this would be config-gen.yml

```yml
presets:
- name: m2
options:
bundle_config: file:test/fixtures/bundle-config.yml
```
## Step 3 - create the `bundle-config.yml` file as noted above.
<details>
<summary>See <code>.json</code> version</summary><p>
{
"presets": [
{
"name": "m2",
"options": {
"bundle_config": "file:test/fixtures/bundle-config.json"
}
}
]
}
</p>
</details>
## Step 3 - create the `bundle-config.yml` or `json` file as noted above.

This is what determines the parent-child relationship. This file is
read from disk every time the `/build.json` or `/loaders.js` endpoint is
requested - which means you can navigate around the site and continue
to tweak these relationships to get the optimal result.

```yaml
```yml
bundles:
- name: "bundles/main"
urls:
Expand All @@ -36,6 +63,33 @@ bundles:
children: []
```

<details>
<summary>See <code>.json</code> version</summary><p>

{
"bundles": [
{
"name": "bundles/main",
"urls": [
"/",
"/index.php/women/tops-women/jackets-women.html"
],
"children": [
{
"name": "bundles/product",
"urls": [
"/index.php/juno-jacket.html"
],
"children": []
}
]
}
]
}

</p>
</details>

## Step 4 - Now run the program against a Magento 2 instance

This will provide you with a new url, something like `http://127.0.0.1`. You should
Expand Down Expand Up @@ -85,11 +139,9 @@ exists etc - but I'm not providing a full script here since requirements will di
## Loading additional bundles
When you access `/__bs/loaders.json`, it will provide Javascript snippets that will allow the additional bundles
to be loaded - exactly how you implement this part is up to you, however we will soon be providing a reference
to be loaded when needed - exactly how you implement this part is up to you, however we will soon be providing a reference
implementation that shows how to add/remove the additional bundles based on some admin flags.
For now though, an example should how to load `bundles/default` on every page, would look like this...
```html
<script src="http://example.com/../requirejs/require.js"></script>
<script src="http://example.com/../mage/requirejs/mixins.js"></script>
Expand Down

0 comments on commit eb7d3c3

Please sign in to comment.