@gdjiami/cli
Version:
CLI for build front end project.
24 lines (23 loc) • 838 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../../utils");
var NAME = 'HtmlInterpolate';
var HtmlInterpolate = /** @class */ (function () {
function HtmlInterpolate(env) {
this.env = env;
}
HtmlInterpolate.prototype.apply = function (compiler) {
var _this = this;
compiler.hooks.compilation.tap(NAME, function (compilation) {
require('html-webpack-plugin')
.getHooks(compilation)
.beforeEmit.tapAsync(NAME, function (data, cb) {
// interpolate enviroments
data.html = utils_1.interpolate(data.html, _this.env);
cb(null, data);
});
});
};
return HtmlInterpolate;
}());
exports.default = HtmlInterpolate;