aboutsummaryrefslogtreecommitdiff
path: root/src/js_printer.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/js_printer.zig')
-rw-r--r--src/js_printer.zig13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/js_printer.zig b/src/js_printer.zig
index 08a1cb5c1..1f920327c 100644
--- a/src/js_printer.zig
+++ b/src/js_printer.zig
@@ -2592,7 +2592,7 @@ fn NewPrinter(
p.addSourceMapping(expr.loc);
// If this was originally a template literal, print it as one as long as we're not minifying
- if (e.prefer_template) {
+ if (e.prefer_template and !p.options.minify_syntax) {
p.print("`");
p.printStringContent(e, '`');
p.print("`");
@@ -3065,6 +3065,17 @@ fn NewPrinter(
while (i < len) {
switch (utf8[i]) {
'\\' => i += 2,
+ '$' => {
+ if (comptime c == '`') {
+ p.print(utf8[0..i]);
+ p.print("\\$");
+ utf8 = utf8[i + 1 ..];
+ len = utf8.len;
+ i = 0;
+ } else {
+ i += 1;
+ }
+ },
c => {
p.print(utf8[0..i]);
p.print("\\" ++ &[_]u8{c});