@saber2pr/tsx-wx

0.0.1 • Public • Published

@saber2pr/tsx-wx

compile tsx into wxml.

# from npm
npm install @saber2pr/tsx-wx

# from github
git clone https://github.com/Saber2pr/tsx-wx.git

Example

import TSX from '@saber2pr/tsx-wx'

const App = ({ names, children }: { names: string[]; children?: string }) => (
  <view>
    <text>{children}</text>
    {names.map(n => (
      <text>{n}</text>
    ))}
  </view>
)

// tsx to string
const wxml = TSX.toString(<App names={['saber', 'saber2pr']}>tsx-wx</App>)
console.log(wxml)

// tsx to string and save in the file.
TSX.toFile('./test.wxml', <App names={['saber', 'saber2pr']}>tsx-wx</App>)

./text.wxml

<view>
  <text>tsx-wx</text>
  <text>saber</text>
  <text>saber2pr</text>
</view>

start

npm install
npm start

npm test

Author: saber2pr


develope and test

you should write ts in /src

you should make test in /src/test

export your core in /src/index.ts!

Readme

Keywords

Package Sidebar

Install

npm i @saber2pr/tsx-wx

Weekly Downloads

2

Version

0.0.1

License

ISC

Unpacked Size

6.67 kB

Total Files

10

Last publish

Collaborators

  • saber2pr