https://github.com/srackham/tag-loader
Riot tag file loader for Webpack
https://github.com/srackham/tag-loader
Last synced: about 1 year ago
JSON representation
Riot tag file loader for Webpack
- Host: GitHub
- URL: https://github.com/srackham/tag-loader
- Owner: srackham
- Created: 2015-01-29T07:42:15.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-11-06T17:38:35.000Z (over 9 years ago)
- Last Synced: 2025-04-28T00:14:46.419Z (about 1 year ago)
- Language: JavaScript
- Size: 152 KB
- Stars: 14
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Riot tag file loader for Webpack
[Webpack](http://webpack.github.io/) can use this loader to automatically compile [Riot](https://muut.com/riotjs/) tag files. Inspired by [this GitHub Gist](https://gist.github.com/guyromm/77d044c1fc75b117c99b).
## Install
npm install tag-loader --save-dev
#### webpack.config.js Configuration
```
:
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](http://webpack.github.io/docs/using-loaders.html).
## ES5 projects
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');
## ES6 projects
Once you've installed and configured the `tag-loader` and [6to5-loader](https://www.npmjs.com/package/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](https://muut.com/riotjs/forum/#!/using:problem-referencing-this-in).