@dkx/env-to-html
v0.1.0
Published
Place environment variable in HTML as json config
Readme
DKX/EnvToHtml
Inject environment variables into html file
Installation
$ npm install --save @dkx/env-to-htmlUsage
$ cat index.html | node_modules/.bin/env-to-html myEnvConfig -e HOME -e CUSTOM=hello > replaced.index.htmlResulting HTML file (replaced.index.html) will now contain new script definition in <head>:
<head>
<script>
window.myEnvConfig = {
"HOME": "/home/david",
"CUSTOM": "hello"
};
</script>
</head>If you don't provide any value for the variable, the current value from your environments variables will be used.
dot env file
.env file is automatically loaded when available.
