Riot CLI

5.1.2 · active · verified Sun Apr 19

Riot CLI is the command-line utility for precompiling Riot.js tags, an open-source UI library. As of its latest stable release, v10.0.0, it wraps the `@riotjs/compiler` to transform Riot.js component files (typically `.riot` files) into standard JavaScript modules. While often installed implicitly with the main `riot` package, it can also be installed and used as a standalone tool. The project follows an active development cycle, releasing major versions to align with new Riot.js framework updates and Node.js environment changes, such as the shift to ESM and stricter Node.js version requirements. Key differentiators include its tight integration with the Riot.js ecosystem, support for various pre-processors and TypeScript, and its ability to not only compile individual tags but also bundle entire Riot.js applications for quick prototypes or development workflows.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates global installation and compiling a basic Riot.js tag file into a JavaScript module using the `riot` command.

npm install -g riot-cli

# Create a simple Riot.js tag file (e.g., my-component.riot)
// my-component.riot
<my-component>
  <h1>Hello, {props.name}!</h1>
  <script>
    export default {
      onMounted() {
        console.log('Component mounted with name:', this.props.name)
      }
    }
  </script>
</my-component>

# Compile the tag file to a JavaScript module
riot my-component.riot my-component.js

console.log('my-component.js has been compiled. You can now import and use it in your application.')

view raw JSON →