Skip to content
Draft
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
11 changes: 6 additions & 5 deletions lib/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const port = 7784;
// and static assets

class Prerender extends Plugin {
constructor(builtAppTree, { urls, indexFile, emptyFile }, ui, plugins, rootURL) {
constructor(builtAppTree, { urls, indexFile, emptyFile, renderMode }, ui, plugins, rootURL) {
super([builtAppTree], { name: 'prember', needsCache: false });
this.urls = urls || [];
this.indexFile = indexFile || 'index.html';
Expand All @@ -27,7 +27,7 @@ class Prerender extends Plugin {
this.protocol = protocol;
this.port = port;
this.host = `localhost:${port}`;

this.renderMode = renderMode;
}

async listUrls(app, protocol, host) {
Expand Down Expand Up @@ -114,8 +114,9 @@ class Prerender extends Plugin {
}
}

async _visit(app, protocol, host, url) {
async _visit(app, protocol, host, url, renderMode) {
let opts = {
renderMode,
request: {
url,
protocol,
Expand All @@ -130,8 +131,8 @@ class Prerender extends Plugin {
return await app.visit(url, opts);
}

async _prerender(app, protocol, host, url) {
let page = await this._visit(app, protocol, host, url);
async _prerender(app, protocol, host, url, renderMode) {
let page = await this._visit(app, protocol, host, url, renderMode);
if (page.statusCode === 200) {
let html = await page.html();
await this._writeFile(url, html);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"denodeify": "^1.2.1",
"ember-cli-babel": "^7.22.1",
"express": "^4.16.2",
"fastboot": "^3.1.2",
"fastboot": "http://gitpkg.now.sh/ember-fastboot/ember-cli-fastboot/packages/fastboot?rehydrate-config",
"mkdirp": "^0.5.1"
},
"devDependencies": {
Expand All @@ -42,7 +42,7 @@
"ember-cli": "~3.22.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-document-title-northm": "^1.0.3",
"ember-cli-fastboot": "^3.0.0-beta.2",
"ember-cli-fastboot": "http://gitpkg.now.sh/ember-fastboot/ember-cli-fastboot/packages/ember-cli-fastboot?rehydrate-config",
"ember-cli-head": "^0.4.0",
"ember-cli-htmlbars": "^5.3.1",
"ember-cli-inject-live-reload": "^2.0.2",
Expand Down
Loading