Basis

Installation

You can install riot via npm:

  1. npm i -S riot

Or via yarn

  1. yarn add riot

Usage

You can bundle your Riot.js application via webpack, rollup, parcel or browserify.Riot tags can be compiled also in directly in your browser for quick prototypes or tests.

Quick Start

Once you have wired all your application bundler that’s how your code might look like this:

index.html

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Riot App</title>
  6. </head>
  7. <body>
  8. <div id="root"></div>
  9. <script src="main.js"></script>
  10. </body>
  11. </html>

app.riot

  1. <app>
  2. <p>{ props.message }</p>
  3. </app>

main.js

  1. import * as riot from 'riot'
  2. import App from './app.riot'
  3. const mountApp = riot.component(App)
  4. const app = mountApp(
  5. document.getElementById('root'),
  6. { message: 'Hello World' }
  7. )