# @tinajs/mina-sfc

> mina single-file-component for wechat mini program, inspried by vue.js

Latest version **0.2.2** (published 2018-08-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tinajs/mina-sfc
pnpm add @tinajs/mina-sfc
yarn add @tinajs/mina-sfc
bun add @tinajs/mina-sfc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2018-08-02 |
| First published | 2017-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | yelo |
| Maintainers | yelo |

## Links

- npm: https://www.npmjs.com/package/@tinajs/mina-sfc
- Repository: https://github.com/tinajs/mina-sfc
- Homepage: https://github.com/tinajs/mina-sfc#readme
- Issues: https://github.com/tinajs/mina-sfc/issues
- npm.io page: https://npm.io/package/@tinajs/mina-sfc

## Dependencies (4)

- [lodash.findlast](https://npm.io/package/lodash.findlast.md) ^4.6.0
- [posthtml-parser](https://npm.io/package/posthtml-parser.md) ^0.2.1
- [posthtml-render](https://npm.io/package/posthtml-render.md) ^1.0.6
- [vue-template-compiler](https://npm.io/package/vue-template-compiler.md) ^2.5.6

## Recent versions

- 0.2.2 (latest) — 2018-08-02
- 0.2.1 — 2018-01-15
- 0.2.0 — 2017-11-24
- 0.1.0 — 2017-11-23

## README

# mina-sfc
> mina single-file-component for wechat mini program, inspried by vue.js

[![npm](https://img.shields.io/npm/v/@tinajs/mina-sfc.svg?style=flat-square)](https://www.npmjs.com/package/@tinajs/mina-sfc)
[![license](https://img.shields.io/github/license/tinajs/mina-sfc.svg?style=flat-square)](./LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

## Installation
```bash
npm i --save @tinajs/mina-sfc
```

## Usage

node.js:
```javascript
const { parse } = require('@tinajs/mina-sfc')

console.log(parse(`
  <config>{}</config>
  <script>console.log('meow~')</script>
`))
```

output:
```json
{
  "_blocks": [{
    "type": "config",
    "content": "{}",
    "attributes": {}
  }, {
    "type": "script",
    "content": "console.log('meow~')",
    "attributes": {}
  }],
  "config": {
    "type": "config",
    "content": "{}",
    "attributes": {}
  },
  "script": {
    "type": "script",
    "content": "console.log('meow~')",
    "attributes": {}
  },
  "style": null,
  "template": null
}
```

## API
### parse(source:String)
Returns sfc object


## Mina SFC Object
### Block Struct
- type

  The tag name

- content

  The raw content

- attributes

  The attributes object (``[name]: value``)

### Special Block
- config
- style
- template
- script

## Related
- [mina-loader](https://github.com/imyelo/mina-webpack/tree/master/packages/mina-loader)
- [vue sfc](https://github.com/vuejs/vue/blob/dev/src/sfc/parser.js)
- [vue template compiler](https://www.npmjs.com/package/vue-template-compiler)

## License
MIT &copy; [yelo](https://github.com/imyelo), 2017 - present

---
_Source: https://npm.io/package/@tinajs/mina-sfc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
