kzmp-cli

1.0.4 • Public • Published

mp-cli

Use

Build a page to a wxml file

kzmp -p page.json

// page.json
[
    {
        "eid":"11",
        "name":"kz-button",
        "value":{
            "text":"按钮",
            "height": 100
        }
    }
]

// generate a file named index.wxml
<wxs module="pageData">
var data = [{"text":"按钮", "height": 100}];
module.exports.data = data;
</wxs>
<kz-button text="{{pageData.data[0].text}}" height="{{pageData.data[0].height}}"/>

Build a complete miniprogram project

// need mp-templates
npm install mp-templates --save-dev

// app is dir of some page json config
// tree app
// app
// ├── detail.json
// └── index.json
kzmp -P app mp

// we will get a mp project
dist/mp
├── app.js
├── app.json
├── app.wxss
├── components
   ├── good-desc
      ├── README.md
      ├── index.js
      ├── index.json
      ├── index.wxml
      └── index.wxss
   ├── good-info
      ├── README.md
      ├── images
         └── qd.png
      ├── index.js
      ├── index.json
      ├── index.wxml
      └── index.wxss
   ├── kz-swiper
      ├── README.md
      ├── index.js
      ├── index.json
      ├── index.wxml
      └── index.wxss
   └── shop-list-easy
       ├── README.md
       ├── index.js
       ├── index.json
       ├── index.wxml
       └── index.wxss
├── jsconfig.json
├── pages
   ├── detail
      ├── index.js
      ├── index.json
      ├── index.wxml
      └── index.wxss
   └── index
       ├── index.js
       ├── index.json
       ├── index.wxml
       └── index.wxss
├── project.config.json
├── typings
   └── wx.d.ts
└── utils
    └── util.js

Name

// 目前的设计
button => @kuaizhan/button
shop-list/shop-list-easy => @kuaizhan/shop-list/shop-list-easy


// Extend: download from github
@github.com/konglx90/mp-templates/components/button

// Extend: other space
@konglx/button

Test

npm run build && node lib/input.js -P test/app

Readme

Keywords

none

Package Sidebar

Install

npm i kzmp-cli

Weekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

103 kB

Total Files

29

Last publish

Collaborators

  • konglx