Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return through.obj(function transform(file, enc, cb) {
if (file.isStream()) {
return cb(new PluginError('angular2-gulp-prerender', 'Streaming is not supported'));
}
var str = file.contents.toString();
var renderPromise = universal.renderToString;
var args = [config.App, config.providers];
if (config.preboot) {
renderPromise = universal.renderToStringWithPreboot;
args.push(config.preboot);
}
renderPromise.apply(null, args)
.then(function(serializedApp) {
var html = str.replace(
//
universal.selectorRegExpFactory(universal.selectorResolver(config.App)),
// {{ serializedCmp }}
serializedApp
);
file.contents = new Buffer(html);