send/server/initScript.js
Danny Coates 1e62aa976d reimplemented l10n using dynamic import() (#1012)
this should greatly reduce the complexity of the l10n code
and build pipeline and eliminate the most common error
seen in sentry logs (no translate function)
2018-11-20 09:50:59 -05:00

18 lines
454 B
JavaScript

const html = require('choo/html');
const raw = require('choo/html/raw');
module.exports = function(state) {
// return '';
return state.cspNonce
? html`
<script nonce="${state.cspNonce}">
const LOCALE = '${state.locale}';
const downloadMetadata = ${
state.downloadMetadata
? raw(JSON.stringify(state.downloadMetadata))
: '{}'
};
</script>
`
: '';
};