Skip to content

让模板管理更接近原生模块化 #69

@otakustay

Description

@otakustay

我们希望能像标准的模块一样去管理我们的模板,像这样:

import {userList, userForm} from 'tpl!user.tpl.html';

let html = userList(data);
xxx.innerHTML = html;

对于每个模板文件,其中的每个target都是一个导出,未命名的target作为默认导出

在此基础上,我们还可以在后期引入tree shaking技术来自动移除未用到的target

为此,我们需要做一些工作,可能会有:

  1. 编译时返回一个Object,是{targetName: render}的集合,这其实就是导出的内容
  2. 增强tpl插件,在AMD环境下给出exports(来自上一步),SystemJS环境下待研究
  3. 去开发一些相对应的Processor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions