Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Latest commit

 

History

History
52 lines (34 loc) · 806 Bytes

getstarted.md

File metadata and controls

52 lines (34 loc) · 806 Bytes

Get Started

install it from npm

npm install -D riot-format

Use it with riot

let's define a riot tag

<app>
  <p>Today is { format(now, 'date', 'yyyy-mm-dd') }</p>

  this.now = new Date()
<app>

mixin it before you can use it

import format from 'riot-format'
import * as riot from 'riot'
format(riot) //mixin globally

riot.mount('app')

Use it directly without riot

import { format } from 'riot-format'
let formatter = format(new Date(), 'date', 'yyyy-mm-dd')
console.log(formatter.current)
//Note: formatter.current is lazily evaluated until you access it

More