An open API service indexing awesome lists of open source software.

https://github.com/afeiship/weapp-vue-parser

Single vue file parser for weapp.
https://github.com/afeiship/weapp-vue-parser

parser vue weapp

Last synced: about 1 month ago
JSON representation

Single vue file parser for weapp.

Awesome Lists containing this project

README

          

# weapp-vue-parser
> Single vue file parser for weapp.

## install:
```bash
npm install -S afeiship/weapp-vue-parser --registry=https://registry.npm.taobao.org
```

## usage:
```js
const fs = require('fs');
const { resolve } = require('path');
const weappVueParser = require('../dist/index').default;
const dist_dir = resolve(__dirname, './card');
const html = fs.readFileSync(
resolve(__dirname, './card.vue')
);

const result = weappVueParser(html.toString());
const { template, style, script } = result;

fs.writeFileSync(`${dist_dir}/card.wxml`, template);
fs.writeFileSync(`${dist_dir}/card.wxss`, style);
fs.writeFileSync(`${dist_dir}/card.js`, script);
```

## result:
```conf
.
├── card.js
├── card.wxml
└── card.wxss
```