2.1.0 • Published 6 years ago

riot-tag-loader v2.1.0

Weekly downloads
2,893
License
MIT
Repository
github
Last release
6 years ago

tag-loader

Build Status Issue Count NPM version NPM downloads MIT License

Riot official webpack loader

Installation

npm i riot-tag-loader riot-compiler -D

Usage in webpack <= 3

Add the riot-tag-loader in your webpack.config.js file

module.exports = {
  module: {
    loaders: [
      {
        test: /\.tag$/,
        exclude: /node_modules/,
        loader: 'riot-tag-loader',
        query: {
          hot: false, // set it to true if you are using hmr
          // add here all the other riot-compiler options riot.js.org/guide/compiler/
          // template: 'pug' for example
        }
      }
    ]
  }
}

Usage in webpack >= 4

Add the riot-tag-loader in your webpack.config.js file

module.exports = {
  module: {
    rules: [
      {
        test: /\.tag$/,
        exclude: /node_modules/,
        use: [{
          loader: 'riot-tag-loader',
          options: {
            hot: false, // set it to true if you are using hmr
            // add here all the other riot-compiler options riot.js.org/guide/compiler/
            // template: 'pug' for example
          }
        }]
      }
    ]
  }
}

If you want to enable hmr you will need to install riot-hot-reload

npm i riot-hot-reload -D

And afterwards you should import the riot-hot-reload API (only once in your bootstrap file) in your project in order to enhance the default riot api

import riot from 'riot'
import 'riot-hot-reload'

// riot will have now a new riot.reload method!!

Source maps

To save time when bundling, it is possible to disable generating source maps via the sourcemap loader option:

options: {
  sourcemap: false
}

Examples

Please check this simple example to see how it's easy to configure webpack with riot