Skip to content

Commit

Permalink
Merge pull request #66 from villander/update-engines
Browse files Browse the repository at this point in the history
Adds section engines + fastboot
  • Loading branch information
villander authored May 29, 2019
2 parents 7a597a8 + 901bedc commit 7417c9f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/guide/addon/utils/table-of-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default [
{ page: 'services', title: 'Sharing Services' },
{ page: 'sharing-components-and-more', title: 'Sharing Components and More' },
{ page: 'lazy-loading', title: 'Lazy Loading' },
{ page: 'addons', title: 'Engines & Addons' },
{ page: 'deploying-engines', title: 'Deploying An Engine' },
{ page: 'addons', title: 'Engines and Addons' },
{ page: 'deploying-and-fastboot', title: 'Deploying and Fastboot' },
{ page: 'testing', title: 'Testing'}
];
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
## Deploying An Engine
## Deploying and Fastboot

### Deploying An Engine

In many cases, your engine code may be served from a static server, typically a CDN; this server will probably not share the same root location as your application. In order to specify the location to get the engine assets, you can implement a `generateURI` function in the host application's `ember-cli-build.js` file:

```js
// host-app/ember-cli-build.js
let app = new EmberApp(defaults, {
assetLoader: {
generateURI: function(filePath) {
generateURI(filePath) {
if (EmberApp.env() === 'production') {
return 'https://production.cdn.com/' + filePath;
return `https://production.cdn.com/${filePath}`;
} else {
return 'local/static/' + filePath;
return `local/static/${filePath}`;
}
}
}
});
```

The `generateURI` function receives the `filePath` for each asset and must return a string of the asset's location. For more info, see the [ember-asset-loader documentation](https://github.com/ember-engines/ember-asset-loader#generating-custom-uris).


### Fastboot

Ember Engines is perfect for combining with server-side rendering solution and works with [FastBoot](https://ember-fastboot.com/) out of the box.

All Engine builds (regardless of whether they are lazy-loaded or not) will generate a `engines-dist/engine-name/config/environment.js` file. This is because we need to load that file in FastBoot for both eager and lazy engines.

0 comments on commit 7417c9f

Please sign in to comment.