magento / magento/baler

Generate `baler-preload-map.json`

Open
#3 0 comments 0 reactions 1 assignee View on GitHub

@DrewML is already working on this.

Since Aug 20, 2019.

enhancement
Dominant language
JavaScript
Stars
176
Forks
28
PR merge metrics
No merged PRs in 30d

Description

For the [`Graph Preloading`](https://github.com/DrewML/baler/blob/58e58744d9e7cf79e35c7b8cac9123cce917a598/docs/HOW_IT_WORKS.md#graph-preloading) functionality, it's necessary for `baler` to spit out a mapping of JavaScript dependencies needed per `.phtml` file.

## Requirements
1. Mapping file should be named `baler-preload-map.json`, and should be written to the root of a locale dir, as a sibling of `requirejs-baler-config.js`
2. A [JSON Schema](https://json-schema.org/) should be provided for `Magento_Baler` to use for validation
3. Key/Value should be
- Key: Path from store root to a `.phtml` file
- Value: Array of relative paths to JavaScript files from the require basedir

## Example

```json
{
"vendor/magento/module-example/view/frontend/templates/some-template.phtml": ["path/to/file/1.js", "path/to/file/2.js"],
"vendor/thirdparty/module-bar/view/frontend/templates/another-template.phtml": ["another/file.js", "yet/another/file/2.js"]
}
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.