@riotjs/register

9.1.0 • Public • Published

@riotjs/register

Allow the import of .riot files importing in node.

Note: you can't import directly .riot files in deno yet. In that case you will need to compile your tags first

Build Status

NPM version NPM downloads MIT License

Installation

npm i @riotjs/register @riotjs/compiler

Usage

  1. Create a module loader file as follows:
import { pathToFileURL } from 'node:url'
import { register } from 'node:module'

register('@riotjs/register', pathToFileURL('./'))
  1. Require the code above by running node as follows:
node --import ./register-riot.js your-program.js

Where register-riot.js is the file where you have pasted the module loader example described above.

This loader supports only type=module projects.

Custom file extensions

To use custom file extensions (instead of .riot) for your Riot.js components you need to set the RIOT_COMPONENTS_FILE_EXTENSIONenvironment variable as follows:

RIOT_COMPONENTS_FILE_EXTENSION=.html node --import ./register-riot.js your-program.js

Readme

Keywords

none

Package Sidebar

Install

npm i @riotjs/register

Weekly Downloads

90

Version

9.1.0

License

MIT

Unpacked Size

4.77 kB

Total Files

4

Last publish

Collaborators

  • gianlucaguarini