快速原型技术

一种基于标签解析的快速原型前端框架:

./skel index.html

 

方案1:静态解析

 

index.html的内容为:

 

<div>

   <h1>标题</h1>

   <banner title=“顶端banner” theme=“c” fixed=“bottom”>

      <icon type=“home” />

   </banner>

</div>

 

解析器遇到banner、icon等不认识的内容时,自动调用banner parser, icon parser来生成对应内容。

本方案和JSX差不多是相同的方案了。有一定难度。更多内容可参考 https://facebook.github.io/jsx/

 

方案2:动态解析

 

index.html的内容为

<div>

  {template banner title=“顶端banner” theme=“c” fixed=“bottom”}

<div>

 

本方案比较呆板简单,和w7用的方案类似。可配置程度低。但很简单。可以基于php实现动态编程,动态展开模板内容。