@tinajs/mina-sfc

0.2.2 • Public • Published

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

  • type

    The tag name

  • content

    The raw content

  • attributes

    The attributes object ([name]: value)

Special Block

  • config
  • style
  • template
  • script

Related

License

MIT © yelo, 2017 - present

Readme

Keywords

none

Package Sidebar

Install

npm i @tinajs/mina-sfc

Weekly Downloads

2

Version

0.2.2

License

MIT

Unpacked Size

7.3 kB

Total Files

6

Last publish

Collaborators

  • malash
  • jimexist
  • yelo