Skip to content
wepy pug/jade 编译插件
Branch: dev
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.gitignore
LICENSE
README.md
index.js
package.json

README.md

wepy jade/pug 编译插件

npm package

Note: wepy官方提供的插件wepy-compiler-pug不支持全局对象传入,查看源码发现该插件的代码有BUG,作者未对BUG进行修复,我提了两次issues都没人改,因此自己提供一个多模板解析插件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-jade --save-dev

Usage

// configure wepy.config.js

module.exports = {
  compilers: {
    jade: {
      engine: 'pug',             // 默认为jade。如果需要使用 pug 模板,就在此处设置
      // enforcePretty: true,       // 默认为false,即:让模板引擎自动美化。该参数用于模板引擎美化失效时强行美化。
      globalConfig: {            // 这个属性名字可以随便定义,只要在模板中使用相同的名字即可
        imgUrlPrefix: ''
      }
    }
  }
};

// write vue/wpy template

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

You can’t perform that action at this time.