-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: For writing a ContentPath, we also need to cope with testing... (#…
…5945) ...and potentially more environments Testing has more additional things in a separate index.html in `tests/` This make the entire thing a little saner and uses just javascriopt template literals instead of a pseudo handbrake synatx for our templating of these files. Intead of just templating the entire file this way, we still only template `{{content-for 'head'}}` and `{{content-for 'body'}}` in this way to ensure we support other plugins/addons
- Loading branch information
1 parent
0ad1c24
commit e8f65e4
Showing
4 changed files
with
87 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = ({ appName, environment, rootURL, config }) => ` | ||
<!-- CONSUL_VERSION: ${config.CONSUL_VERSION} --> | ||
<script> | ||
var setConfig = function(appName, config) { | ||
var $meta = document.querySelector('meta[name="' + appName + '/config/environment"]'); | ||
var defaultConfig = JSON.parse(decodeURIComponent($meta.getAttribute('content'))); | ||
( | ||
function set(blob, config) { | ||
Object.keys(config).forEach( | ||
function(key) { | ||
var value = config[key]; | ||
if(Object.prototype.toString.call(value) === '[object Object]') { | ||
set(blob[key], config[key]); | ||
} else { | ||
blob[key] = config[key]; | ||
} | ||
} | ||
); | ||
} | ||
)(defaultConfig, config); | ||
$meta.setAttribute('content', encodeURIComponent(JSON.stringify(defaultConfig))); | ||
} | ||
setConfig( | ||
'${appName}', | ||
{ | ||
rootURL: '${rootURL}' | ||
} | ||
); | ||
</script> | ||
<link rel="icon" type="image/png" href="${rootURL}assets/favicon-32x32.png" sizes="32x32"> | ||
<link rel="icon" type="image/png" href="${rootURL}assets/favicon-16x16.png" sizes="16x16"> | ||
<link integrity="" rel="stylesheet" href="${rootURL}assets/vendor.css"> | ||
<link integrity="" rel="stylesheet" href="${rootURL}assets/${appName}.css"> | ||
${ | ||
environment === 'test' ? `<link rel="stylesheet" href="${rootURL}assets/test-support.css">` : `` | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters