Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds section engines + fastboot #66

Merged
merged 4 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.