Skip to content

Commit

Permalink
chore(prerender): output prerendered index.html for debugging (#8483)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba authored and jelbourn committed Nov 20, 2017
1 parent 2a3baa1 commit a5b0872
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/universal-app/prerender.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'reflect-metadata';
import 'zone.js';

import {enableProdMode} from '@angular/core';
import {renderModuleFactory} from '@angular/platform-server';
import {join} from 'path';
import {readFileSync} from 'fs-extra';
import {readFileSync, writeFileSync} from 'fs-extra';
import {log} from 'gulp-util';
import {join} from 'path';
import 'reflect-metadata';
import 'zone.js';
import {KitchenSinkServerModuleNgFactory} from './kitchen-sink/kitchen-sink.ngfactory';

enableProdMode();
Expand All @@ -15,7 +14,10 @@ const result = renderModuleFactory(KitchenSinkServerModuleNgFactory, {
});

result
.then(() => log('Prerender done.'))
.then(content => {
writeFileSync(join(__dirname, 'index-prerendered.html'), content, 'utf-8');
log('Prerender done.');
})
// If rendering the module factory fails, exit the process with an error code because otherwise
// the CI task will not recognize the failure and will show as "success". The error message
// will be printed automatically by the `renderModuleFactory` method.
Expand Down

0 comments on commit a5b0872

Please sign in to comment.