.. | ||
src | ||
package.json | ||
README.md | ||
register.js |
@riotjs/register
Allow .riot
files importing in node.
Notice: you can't import directly .riot
files in deno yet.
In that case you will need to compile your tags first
Installation
npm i @riotjs/register @riotjs/compiler
Usage
You can enable the .riot
files import by simply preloading this module
node -r @riotjs/register your-app.js
Advanced usage
If you need to disable the .riot
files import you can use the teardown function exported:
const register = require('@riotjs/register')
// create the optional teardown function
const teardown = register()
// import you riot files here
const App = require('./app.riot')
// disable the .riot files import
teardown()
// this call will fail
require('./app.riot')
If you use mocha
for your unit tests you can require it with the mocha -r @riotjs/register