wepy-compiler-view

2.0.1 • Public • Published

wepy template 编译器

npm package

Note: wepy官方提供的插件wepy-compiler-pug不支持全局对象传入,查看源码发现该插件的代码有BUG,因此自己提供一个多模板解析插件wepy-compiler-view。唯一的遗憾,就是在编辑器中没有展示高亮语法提示,因此,另外提供了wepy-compiler-jade插件,方便展示高亮语法提示。

如果该插件对您的开发有所帮助,请五星好评哦!^^ ^^ ^_^


WePY

Table of contents


Features

Supported template engines

NOTE: you must still install the engines you wish to use, add them to your package.json dependencies.

installation

cnpm install wepy-compiler-view --save-dev

Usage

// configure wepy.config.js

module.exports = {
  compilers: {
    view: {
      engine: 'pug',
      render: promise,           // (选填)自定义渲染函数,支持promise
      globalConfig: {          // 这个属性名字可以随便定义,只要在模板中使用相同的名字即可
        imgUrlPrefix: ''
      }
    }
  }
};

// write vue/wpy template

<template lang="view">
  view
    image(src=`${globalConfig.imgUrlPrefix}/images/xxx.svg`)
</template>    

Package Sidebar

Install

npm i wepy-compiler-view

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

9.59 kB

Total Files

6

Last publish

Collaborators

  • fengxinming