Skip to content

nftgem/ftl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ftl

ftl - the fast template language for React UI components.

What is ftl?

ftl is a fast template language for React UI components. It is a superset of the ES6 template literal syntax, with a few additional features to make it easier to write React components.

npm version Build Status

example

Box
    Grid container spacing={2}
        Grid item xs={6}
            Typography variant="h3" (Welcome to ${id} Staking Pool!!)
            Typography variant="subtitle1" (stake your tokens to earn more tokens)

is converted to:

<Box>
    <Grid container spacing={2}>
        <Grid item xs={6}>
            <Typography variant="h3">Welcome to {id} Staking Pool!!</Typography>
            <Typography variant="subtitle1">stake your tokens to earn more tokens</Typography>
        </Grid>
    </Grid>
</Box>

Usage:

const template = ftl`
    Box
        Grid container spacing={2}
            Grid item xs={6}
                Typography variant="h3" (Welcome to ${id} Staking Pool!!)
                Typography variant="subtitle1" (stake your tokens to earn more tokens)
`
const Component = template({id: 'My Pool'})
ReactDOM.render(<Component />, document.getElementById('root'))

Installation

npm install ftl

or

yarn add ftl

ftl template files

ftl template files are just .ftl files. They can be imported into your typescript or javascript files, and then used to create React components.

import template from './template.ftl'
const Component = template({id: 'My Pool'})
ReactDOM.render(<Component />, document.getElementById('root'))

ftl template strings

ftl template strings are just template strings. They can be used to create React components.

const template = ftl`
    Box
        Grid container spacing={2}
            Grid item xs={6}
                Typography variant="h3" (Welcome to ${id} Staking Pool!!)
                Typography variant="subtitle1" (stake your tokens to earn more tokens)
`
const Component = template({id: 'My Pool'})
ReactDOM.render(<Component />, document.getElementById('root'))

ftl template functions

ftl template functions are just functions. They can be used to create React components.

const template = ftl`
    Box
        Grid container spacing={2}
            Grid item xs={6}
                Typography variant="h3" (Welcome to ${id} Staking Pool!!)
                Typography variant="subtitle1" (stake your tokens to earn more tokens)
`

## run the tests

`npm test`

## License

MIT

About

Fast Template Language for React

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published