Skip to content

Commit

Permalink
Warn when ember-cli-fastboot does not find an asset map
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjan Singh committed Sep 22, 2016
1 parent d0b1c21 commit edcd3af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/broccoli/fastboot-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function FastBootBuild(options) {
})[0];

if (assetRev && assetRev.options) {
this.assetMapEnabled = !!(assetRev.options.enabled && assetRev.options.assetMapPath);

if (assetRev.options.assetMapPath) {
this.assetMapPath = assetRev.options.assetMapPath;
}
Expand Down Expand Up @@ -118,7 +120,7 @@ FastBootBuild.prototype.buildConfigTree = function(tree) {
return new FastBootConfig(tree, {
project: this.project,
name: this.app.name,
assetMapPath: this.assetMapPath,
assetMapEnabled: this.assetMapEnabled,
outputPaths: this.app.options.outputPaths,
ui: this.ui,
fastbootAppConfig: fastbootConfig,
Expand Down
5 changes: 4 additions & 1 deletion lib/broccoli/fastboot-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,16 @@ FastBootConfig.prototype.buildDependencies = function() {
};

FastBootConfig.prototype.readAssetManifest = function() {
if (!this.assetMapEnabled) return '';

var ui = this.ui;
var assetMapPath = path.join(this.inputPaths[0], 'fastbootAssetMap.json');

try {
var assetMap = JSON.parse(fs.readFileSync(assetMapPath));
return assetMap;
} catch (e) {
// No asset map was found, proceed as usual
ui.writeLine(fmt("fastbootAssetMap.json not found at: %s", assetMapPath), ui.WARNING);
}
};

Expand Down

0 comments on commit edcd3af

Please sign in to comment.