Parceljs配置

问题描述 投票:0回答:1

我在index.html中导入html文件时遇到问题。

我的package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "test",
  "author": "test",
  "license": "ISC",
  "dependencies": {
    "del": "^3.0.0",
    "i": "^0.3.6"
  },
  "devDependencies": {
    "parcel-bundler": "^1.12.3"
  },
  "scripts": {
    "start": "parcel src/pages/index.html"
  }
}

My project structure

我曾尝试像这样在index.html中包含header.html,但这没有用。<include src="src/pages/templates/header.html"></include>

我如何在index.html页面上包含html文件?

web frontend bundler parceljs
1个回答
0
投票

尝试使用此插件:https://github.com/posthtml/posthtml-modules

它可能需要在您的项目根目录中使用以下.posthtmlrc文件(假定为src文件夹:]

{
  "plugins": {
    "posthtml-modules": {
      "root": "src"
    }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.