diff --git a/addon/ng2/blueprints/ng2/files/__path__/index.html b/addon/ng2/blueprints/ng2/files/__path__/index.html index 856b638ac908..33004620cd45 100644 --- a/addon/ng2/blueprints/ng2/files/__path__/index.html +++ b/addon/ng2/blueprints/ng2/files/__path__/index.html @@ -17,9 +17,7 @@ {{/each}} - + {{/if}} <% } %> diff --git a/addon/ng2/blueprints/ng2/files/package.json b/addon/ng2/blueprints/ng2/files/package.json index baaa6307b5c1..88f27e581b7c 100644 --- a/addon/ng2/blueprints/ng2/files/package.json +++ b/addon/ng2/blueprints/ng2/files/package.json @@ -29,6 +29,8 @@ }, "devDependencies": {<% if(isMobile) { %> "@angular/platform-server": "2.0.0-rc.1", + "angular2-broccoli-prerender": "^0.11.0", + "angular2-service-worker": "0.1.11", "angular2-universal":"^0.100.3", "angular2-universal-polyfills": "^0.4.1", "preboot": "^2.0.10",<% } %> diff --git a/lib/broccoli/angular2-app.js b/lib/broccoli/angular2-app.js index 7d7504931aef..3ca0bb6d5ff8 100644 --- a/lib/broccoli/angular2-app.js +++ b/lib/broccoli/angular2-app.js @@ -159,6 +159,14 @@ class Angular2App extends BroccoliPlugin { merged = this._getBundleTree(merged); } + if (this.ngConfig.apps[0].mobile) { + var ServiceWorkerPlugin = require('angular2-service-worker').ServiceWorkerPlugin; + var swTree = new ServiceWorkerPlugin(merged); + merged = BroccoliMergeTrees([merged, swTree], { + overwrite: true + }); + } + return new BroccoliFunnel(merged, { destDir: this._destDir, overwrite: true @@ -348,6 +356,10 @@ class Angular2App extends BroccoliPlugin { var vendorNpmFiles = [ ]; + if (this.ngConfig.apps[0].mobile) { + vendorNpmFiles.push('angular2-service-worker/dist/worker.js') + } + if (this._options.vendorNpmFiles) { vendorNpmFiles = vendorNpmFiles.concat(this._options.vendorNpmFiles); }