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.
- Host: GitHub
- URL: https://github.com/afeiship/weapp-vue-parser
- Owner: afeiship
- License: mit
- Created: 2018-06-29T10:58:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-01T17:01:59.000Z (almost 8 years ago)
- Last Synced: 2025-10-27T03:16:23.034Z (8 months ago)
- Topics: parser, vue, weapp
- Language: JavaScript
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
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
```