内插Html 插件
替换 HTML 模板中的变量名称.
灵感来自 反应- dev-utils/interpolate-html-插件。 。 。 .
写入 类型脚本 与 ♥
概览
它与最新版本的 HtmlWebpackPlugin 财务报告和审定财务报表 webpack。您可以更多地学习创建这样的插件 这里。 。 。 .
安装
| 国家预防机制 | 也门 |
npm i -D webpack html-webpack-plugin | yarn add -D webpack html-webpack-plugin |
npm i -D @gozenc/interpolate-html-plugin | yarn add -D @gozenc/interpolate-html-plugin |
使用量
const HtmlWebpackPlugin = require("html-webpack-plugin")
const InterpolateHtmlPlugin = require("@gozenc/interpolate-html-plugin")
// In the webpack.config file:
...
plugins: [
new InterpolateHtmlPlugin(HtmlWebpackPlugin, {
'PUBLIC_URL': "https://example.com",
// Replaces %PUBLIC_URL% with https://example.com in index.html.
VARIABLE: 1024,
// Replaces %VARIABLE% with 1024 in index.html.
}),
...
发展
我知道建造管线看起来有点奇怪 但我正在做一些Linux练习 与节点同时 用于表演者建造管线。 我也可以加入一些C电话。 我将来会进一步发展它,但当然我愿意讨论它.
当然,我很乐意解决这些请求.
待办
- 添加 Webpack@ 3 支持 .
- 添加网络包@ 4 支持 .
- 更多开发测试套房.
- Hook.tap params的类型定义.
关于 @gozenc/interpolate-html-plugin 的常见问题
@gozenc/interpolate-html-plugin 是什么?
InterponateHtmlPlugin为webpack v5执行.
如何安装 @gozenc/interpolate-html-plugin?
在项目目录运行 npm install @gozenc/interpolate-html-plugin,或使用 pnpm add / yarn add / bun add。
@gozenc/interpolate-html-plugin 支持 TypeScript 吗?
该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gozenc__interpolate-html-plugin 是否存在。
@gozenc/interpolate-html-plugin 支持 ESM 还是 CommonJS?
以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。
@gozenc/interpolate-html-plugin 可以商用吗?
@gozenc/interpolate-html-plugin 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。
@gozenc/interpolate-html-plugin 的下载量有多少?
根据 npm 官方下载统计,@gozenc/interpolate-html-plugin 在 2026/10/17 – 2026/11/15 这 30 天内被下载 5,930 次,日均约 198 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。
@gozenc/interpolate-html-plugin 还在维护吗?
最新版本 1.0.2 发布于 2021/04/02(5 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/04/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。