Skip to content

Commit

Permalink
Merge pull request #250 from mipengine/dev-doc
Browse files Browse the repository at this point in the history
文档修改
  • Loading branch information
liuruoran88 authored Sep 5, 2018
2 parents f2fa167 + 9d38ec6 commit 00a2469
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
31 changes: 23 additions & 8 deletions docs/guide/mip-standard/mip-components-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

## 源文件仓库

MIP 扩展组件的中央仓库是 https://github.com/mipengine/mip2-extensions 。中央仓库 master 分支下的代码永远是稳定的。根目录下,每个 mip- 前缀的目录为一个扩展组件。
MIP 官方扩展组件仓库是 https://github.com/mipengine/mip2-extensions 。中央仓库 master 分支下的代码永远是稳定的。根目录下,每个 mip- 前缀的目录为一个扩展组件。
MIP 第三方组件仓库是 https://github.com/mipengine/mip2-extensions-platform。

## 开发方式

Expand All @@ -25,7 +26,7 @@ MIP 扩展组件开发采用 [Forking工作流](https://github.com/oldratlee/tra
- <a href="#5">CSS 规范</a>


<a name="1"></a>
<a id="1"></a>
## 目录规范

#### 1. 官方组件
Expand All @@ -47,11 +48,11 @@ MIP 扩展组件开发采用 [Forking工作流](https://github.com/oldratlee/tra
- 站长组件目录结构与官方组件基本一致,规范参考上述第 1 点。
- [MUST] (补充)站长组件命名需要加上站点名称标识,如 `mysite.com` 下的 tab 组件,可命名为 `mip-mysite-tab`

示例
单个组件结构示例

```bash
components
├── mip-mysite-example
├── mip-mysite-example // 组件 1
├── mip-mysite-example.vue
├── README.md
├── example
Expand All @@ -60,13 +61,27 @@ MIP 扩展组件开发采用 [Forking工作流](https://github.com/oldratlee/tra
```


<a name="2"></a>

第三方组件结构示例
```bash
mip2-extensions-platform
├── sites
├── baidu.com // 具体第三方站点名
├── components
├── mip-baidu-header // 组件 1
├── mip-baidu-footer // 组件 2
├── mip-baidu-nav // 组件 3
```



<a id="2"></a>
## 文档规范

文档规范指的是各组件目录下的 README.md 文件的编写规范,MIP2 复用 [MIP1 的规范](https://github.com/mipengine/mip-extensions/blob/master/docs/spec-readme-md.md)


<a name="3"></a>
<a id="3"></a>
## 命名规范

命名规范涵盖以下几个部分
Expand Down Expand Up @@ -104,7 +119,7 @@ MIP 自定义组件的配置项需符合 Camel 规范,不得采用中划线
</mip-a>
```

<a name="4"></a>
<a id="4"></a>
## JavaScript 规范

- [MUST] 组件的脚本开发必须遵守 JavaScript Standard Style [[CN](https://standardjs.com/rules-zhcn.html)/[EN](https://standardjs.com/rules-en.html)] 代码规范
Expand All @@ -115,7 +130,7 @@ MIP 自定义组件的配置项需符合 Camel 规范,不得采用中划线
开发过程中可以通过 [ESLint](https://eslint.org/) 工具检查,在组件校验和审核环节要求所有代码必须通过 ESLint,一般不允许使用 `eslint-disable` 来豁免检测。


<a name="5"></a>
<a id="5"></a>
## CSS 规范

- [MUST] 组件的样式必须遵循 Stylelint 中 [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard) 中包含的规范,且必须通过 Stylelint 工具审核之后才能提交。
Expand Down
8 changes: 4 additions & 4 deletions docs/guide/mip-standard/mip-html-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MIP 规范是高性能 MIP 页面的保证,其中最重要的规范是:MIP H

由于规范长期更新,更多最新规范可查阅 MIP 官方网站 MIP HTML规范章节。

<a name="1"></a>
<a id="1"></a>
### 1. 头部使用规范
下面简要列出MIP页头部的使用规范。头部是MIP页的声明、配置信息、资源引入的主要区域。
- 页面起始标签使用 <!DOCTYPE html>
Expand All @@ -23,7 +23,7 @@ MIP 规范是高性能 MIP 页面的保证,其中最重要的规范是:MIP H
- 必须在 `<body>` 标签底部包含 `<script src="<script src="https://c.mipcdn.com/static/v2/mip.js"></script>` ,如果包含在 `<head>` 标签中则须增加 `async` 属性。


<a name="2"></a>
<a id="2"></a>
### 2. 页面元素

MIP-HTML 禁止使用对页面性能以及安全有较大影响的标签,同时也规定了元素的使用方式。
Expand Down Expand Up @@ -136,13 +136,13 @@ MIP-HTML 禁止使用对页面性能以及安全有较大影响的标签,同
|`type`||-|


<a name="3"></a>
<a id="3"></a>
### 3. HTML 属性
- MIP-HTML 中所有 `on` 开头的属性都不允许使用,如:`onclick``onmouseover`
- MIP-HTML 中允许使用 `on` 属性。
- MIP-HTML 中不允许使用 `style` 属性。

<a name="4"></a>
<a id="4"></a>
### 4. 自定义样式使用规范
出于性能考虑,HTML 中不允许使用内联 `style`,所有样式只能放到 `<head>``<style>` 标签里。

Expand Down

0 comments on commit 00a2469

Please sign in to comment.