alibaba / alibaba/ice

MPA 场景下增强通过 ejs 定制不同页面的 html 内容

Open
#4,985 0 comments 0 reactions 1 assignee View on GitHub

@imsobear is already working on this.

Since Jan 24, 2022.

discussion
Dominant language
TypeScript
Stars
18.6k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

> 优先级不高

## What is the current behavior? 发生了什么?

比如多个页面都要在 body 上挂一个属性,且不同页面的属性值不一样,目前有两种做法:

- 每个页面使用不同的 html
- 在 index.html 里通过 ejs + pageName 这个变量再做区分

这两种成本都比较高。

## What is the expected behavior? 期望的结果是什么?

是否考虑类似下面的方式:

```json
{
"mpa": {
"pageStaticConfig": {
"home": { "title": "哈哈" },
"about": { "title": "呵呵" }
}
}
}
```

然后将对应页面的 pageStaticConfig 通过 ejs 变量透传给 html。

## Any additional comments? 相关环境信息?

- **ice.js Version**:
- **build.json Configuration**:
- **Node Version**:
- **Platform**:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.