twh-preview

2.0.10 • Public • Published

twh-preview

Test coverage Build Status Dependency Status devDependency Status NPM version node License npm download

渲染服务预览npm包

Installation

$ npm install twh-preview

Usage

page结构

const preview = require('twh-preview');
const config = {
    "page": {
        "templates": {
            "index.xtpl": " {{$system.isAliIntranet}} haha demo {{ include ('./age.xtpl')}}", //模板入口,必选
            'age.xtpl': '{{$data.age}}',
            "seed.json": "{}" //seed依赖,可选
        }
    },
    "data": {
            "age": "爱的色放l1撒发" //(mock数据,可选)
    },
    "intranet": true //是否内网,默认true (可选)
};
preview(config).then(data => {
  console.log(data)
}).catch();

代码片段结构

const preview = require('twh-preview');
const config = {
  'page': {
    'name': 'fdemo', // 代码片段path值,必选。必须符合JS函数命名规范
    'preview': 'fragment', // 必选,值必须是"fragment"
    'templates': {
      'index.xtpl': `{{$system.isAliIntranet}} haha demo {{ include ('./age.xtpl')}}`, //模板入口,必选
      'age.xtpl': '{{$data.age}}',
      'seed.json': '{}', //seed依赖,可选
    },
  },
  'data': {
    'age': '好老好老啊', //(mock数据,可选)
  },
  'intranet': true, //是否内网,默认true (可选)
};
preview(config).then(data => {
  console.log(data)
}).catch();

Readme

Keywords

Package Sidebar

Install

npm i twh-preview

Weekly Downloads

1

Version

2.0.10

License

MIT

Unpacked Size

21.5 kB

Total Files

12

Last publish

Collaborators

  • 306766053
  • lfeng