Webpack can use this loader to automatically compile Riot tag files. Inspired by this GitHub Gist.
npm install tag-loader --save-dev
:
module: {
loaders: [
{ test: /\.tag$/, loader: 'tag' },
:
]
}
:
Use query parameters to include Riot compiler command options. Examples:
{ test: /\.tag$/, loader: 'tag?compact' },
{ test: /\.tag$/, loader: 'tag', query: {compact: 'true'} },
See also the Webpack loader documentation.
Once you've installed and configured the tag-loader
you can require Riot tag files into your project using the require()
function e.g.
require('./tags.tag');
Once you've installed and configured the tag-loader
and 6to5-loader you can import Riot tag files into your project using the ES6 module import
statement e.g.
import './tags.tag'
NOTE: I do not recommend using ES6 code inside Riot tag files, here's why.