wepy-compiler-jade
v2.0.1
Published
a template compiler for wepy as pug, jade
Downloads
11
Maintainers
Readme
wepy jade/pug 编译插件并支持多模板解析
Note: wepy官方提供的插件
wepy-compiler-pug
不支持全局对象传入,查看源码发现该插件的代码有BUG,在Github上的Issues也无人回复,因此自己提供一个多模板解析插件wepy-compiler-jade
。
如果该插件对您的开发有所帮助,请五星好评哦!^^ ^^ ^_^
Table of contents
Features
Supported template engines
- atpl
- bracket
- doT.js (website)
- dust (unmaintained) (website)
- dustjs-linkedin (maintained fork of dust) (website)
- eco
- ect (website)
- ejs (website)
- haml
- haml-coffee
- hamlet
- handlebars (website)
- hogan (website)
- htmling
- jade (website)
- jazz
- jqtpl
- JUST
- liquor
- lodash (website)
- marko (website)
- mote (website)
- mustache
- nunjucks (website)
- plates
- pug (formerly jade) (website)
- QEJS
- ractive
- react
- slm
- swig (unmaintained)
- swig (maintained fork)
- teacup
- templayed
- twig
- liquid (website)
- toffee
- underscore (website)
- vash
- walrus (website)
- whiskers
NOTE: you must still install the engines you wish to use, add them to your package.json dependencies.
installation
cnpm install wepy-compiler-jade@beta --save-dev
Usage
// configure wepy.config.js
module.exports = {
compilers: {
jade: {
engine: 'pug', // 默认为jade,如果需要使用pug或其它模板,就在此处设置
render: promise, // 自定义渲染函数,支持promise
options: {
globalConfig: { // 这个属性名字可以随便定义,只要在模板中使用相同的名字即可
imgUrlPrefix: ''
}
}
}
}
};
// write vue/wpy template
<template lang="jade">
view
image(src=`${globalConfig.imgUrlPrefix}/images/xxx.svg`)
</template>