aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/loader/to-string-loader.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/loader/to-string-loader.js')
-rw-r--r--config/webpack/loader/to-string-loader.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/config/webpack/loader/to-string-loader.js b/config/webpack/loader/to-string-loader.js
index 248574a..244ae7a 100644
--- a/config/webpack/loader/to-string-loader.js
+++ b/config/webpack/loader/to-string-loader.js
@@ -1,3 +1,13 @@
+/**
+ * Webpack loader that converts HTML template files into JavaScript modules.
+ * It escapes template literals and replaces `$name$` placeholders with
+ * `${name}` interpolation syntax so the exported function can accept a
+ * replacements object.
+ *
+ * @param {string} source - Raw HTML file content.
+ * @returns {string} A JS module that exports a function accepting
+ * replacement values and returning the interpolated HTML string.
+ */
export default function(source) {
source = source
.replaceAll("\\", "\\\\")