diff --git a/addon/initializers/asset-map.js b/addon/initializers/asset-map.js index e46dee4..7e4d6fb 100644 --- a/addon/initializers/asset-map.js +++ b/addon/initializers/asset-map.js @@ -14,6 +14,10 @@ export function initialize(app) { let assetMapFile = window && window.__assetMapPlaceholder__; + if (!assetMapFile) { + assetMapFile = decodeURIComponent(document.querySelector('[property="ifa:placeholder"]').getAttribute('content')); + } + if (!assetMapFile) { app.register('service:asset-map', AssetMap); return; diff --git a/index.js b/index.js index f807e83..4c8ebb3 100644 --- a/index.js +++ b/index.js @@ -54,10 +54,9 @@ module.exports = { if (ifaConfig.inline && fs.existsSync(assetFileNamePath)) { assetMapPlaceholder = fs.readFileSync(assetFileNamePath, {encoding: 'utf-8'}); - } else { if (assetFileName) { - assetMapPlaceholder = `"${fingerprintPrepend}assets/${assetFileName}"`; + assetMapPlaceholder = encodeURIComponent(`${fingerprintPrepend}assets/${assetFileName}`); } } @@ -69,7 +68,9 @@ module.exports = { }, contentFor(type, config) { - if (type === 'head-footer' && config.ifa && config.ifa.enabled) { + if (type === 'head' && config.ifa && config.ifa.enabled && !config.ifa.inline) { + return ''; + } else if (type === 'head-footer' && config.ifa && config.ifa.enabled && config.ifa.inline) { return ''; } }