0.1.5 • Published 4 years ago

@saber2pr/tsx v0.1.5

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

@saber2pr/tsx

a tsx renderer for the browser and node.js

纯粹的视图层

# from npm
npm install @saber2pr/tsx

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

Examples

in browser.

import TSX, { renderDOM } from '@saber2pr/tsx'

function HelloMessage({ name }) {
  return <div>Hello {name}</div>
}

// render to dom.
document
  .getElementById('root')
  .append(renderDOM(<HelloMessage name="Taylor" />))

in node.js

import TSX, { renderString, Style } from '@saber2pr/tsx'

function Page({ name }) {
  return (
    <html>
      <head>
        <Style>
          {{
            '.myTsx': { color: 'blue' }
          }}
        </Style>
        <title>{name}</title>
      </head>
      <body>
        <div className="myTsx">myTsx</div>
      </body>
    </html>
  )
}

// render to string.
console.log(renderString(<Page name="My Tsx" />))

tsx

  1. tsx map
  2. tsx render children

and more feature supported.

tsconfig

ensure:

{
  "compilerOptions": {
    "jsx": "react",
    "jsxFactory": "TSX"
  }
}

start

npm install
npm start

npm run dev

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!

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago