Parcel plugin that interpolates ENV in HTML files
yarn add --dev parcel-plugin-interpolate-html
or
npm i -d parcel-plugin-interpolate-html
Attention: parcel-bundler has to be installed
There is no need to enable the plugin in any configuration file. If you want to use it you can do so after installing.
You have to escape the ENV with %% around it e.g. %example%
.
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>%title%</title>
</head>
</html>
.env
title=Example
run it
parcel index.html
output
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Example</title>
</head>
</html>