From f87e4e3a7c14588337cead730d7d65f181f5f40b Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 30 May 2019 16:48:20 +0200 Subject: [PATCH] Mention the template loader in the plugin docs --- docs/source/plugin_development.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/source/plugin_development.rst b/docs/source/plugin_development.rst index c67fdd9e9..e8830d4c1 100644 --- a/docs/source/plugin_development.rst +++ b/docs/source/plugin_development.rst @@ -254,6 +254,26 @@ For example, in your webpack config file, you could add the following to the .. code-block:: javascript + module: { + { + test: /templates\/.*\.(html|svg)$/, + use: [{ + loader: 'lodash-template-webpack-loader', + options: { + escape: /\{\{\{([\s\S]+?)\}\}\}/g, + evaluate: /\{\[([\s\S]+?)\]\}/g, + interpolate: /\{\{([\s\S]+?)\}\}/g, + // By default, template places the values from your data in the + // local scope via the with statement. However, you can specify + // a single variable name with the variable setting. This can + // significantly improve the speed at which a template is able + // to render. + variable: 'o', + prependFilenameComment: __dirname + } + }] + } + }, resolve: { extensions: ['.js'], modules: [ @@ -266,6 +286,14 @@ For example, in your webpack config file, you could add the following to the } +You'll need to install ``lodash-template-webpack-loader``. + +Currently Converse uses a fork of `lodash-template-webpack-loader `_. + +To install it, you can add ``"lodash-template-webpack-loader": "jcbrand/lodash-template-webpack-loader"`` +to your package.json's ``devDependencies``. + + .. _`dependencies`: Plugin dependencies