Skip to content

Commit f423ba1

Browse files
author
zhangwentao
committed
update read
1 parent ba3dfba commit f423ba1

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,57 @@ npm install her-preprocessor-fispadaptor -g
1212
```
1313
fis.config.get('modules.preprocessor.tpl').unshift('fispadaptor')
1414
```
15+
16+
##FISP模块迁移文档##
17+
18+
###1.替换smarty运行时插件###
19+
20+
下载最新的[Her smarty运行时插件](http://gitlab.baidu.com/hao123-fe/her-smarty-plugin/tree/master)
21+
22+
复制plugin目录下所有文件到原fisp的plugin目录,并删除fisp同名的编译插件compiler.require.php、compiler.script.php、compiler.widget.php
23+
24+
注意:
25+
`{html}`插件会根据是否quickling请求决定是否输出DOCTYPE
26+
```html
27+
<!DOCTYPE html>
28+
```
29+
所以不需要在模板中输出DOCTYPE,需要删除模板中直接输出的DOCTYPE。
30+
31+
###2.替换前端运行时框架###
32+
33+
前端运行时框架在static目录,其中bigpipe.js和amd.js是框架运行必须的代码,需要在`{html}`标签初始化,可以用inline的方式引入,例如:
34+
35+
```smarty
36+
{strip}
37+
{html framework="common:static/lib.js" lang="zh-cn"}
38+
{head}
39+
```
40+
注意:
41+
为了性能优化,Her前端运行时根据资源的依赖关系使用loader异步加载资源,默认只有框架js和`{pagelet}`外依赖的css是同步输出到页面的。
42+
43+
所以对于公用的库(例如jquery),建议用依赖管理的方式使用,即使用jquery的时候都要声明依赖:
44+
```javascript
45+
require('common:static/jquery.js');
46+
// then use $ or jQuery as global namespace
47+
48+
// or
49+
var $ = require('common:static/jquery.js');
50+
// then use $ as local variable (recommend)
51+
```
52+
53+
如果不想每次使用jquery的时候都声明依赖,可以把jquery inline到lib.js中,这样jquery会同步加载,之后的js都可以直接使用`$` or `jQuery`全局变量。但是从性能优化的角度,不建议这样做。
54+
55+
###3.安装预处理插件和配置fis-conf###
56+
按上面的使用方法安装her-preprocessor-fispadaptor和配置fis-conf。
57+
58+
###4.用her release命令发布模块###
59+
运行
60+
```
61+
$ her release -c
62+
```
63+
发布模块。至此你的模块已经可以run起来,你可以继续按下面的步骤就行性能优化。
64+
65+
###5.性能优化###
66+
67+
68+

0 commit comments

Comments
 (0)