Skip to content

Saber2pr/tsx-wx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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!

About

> compile tsx into wxml.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published