Home

Awesome

mina-sfc

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

npm license PRs Welcome

Installation

npm i --save @tinajs/mina-sfc

Usage

node.js:

const { parse } = require('@tinajs/mina-sfc')

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

output:

{
  "_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

Special Block

Related

License

MIT © yelo, 2017 - present