@dkx/env-to-html
v0.1.0
Published
Place environment variable in HTML as json config
Downloads
1
Readme
DKX/EnvToHtml
Inject environment variables into html file
Installation
$ npm install --save @dkx/env-to-html
Usage
$ cat index.html | node_modules/.bin/env-to-html myEnvConfig -e HOME -e CUSTOM=hello > replaced.index.html
Resulting 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.