From 5923e2a211e90bf6d9780dd768bb7feba7691ea7 Mon Sep 17 00:00:00 2001 From: m1ga Date: Sat, 1 Jul 2023 21:02:37 +0200 Subject: [PATCH 1/3] feat: tss include --- Alloy/commands/compile/styler.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Alloy/commands/compile/styler.js b/Alloy/commands/compile/styler.js index d27d5bda6..f19a47b3b 100644 --- a/Alloy/commands/compile/styler.js +++ b/Alloy/commands/compile/styler.js @@ -287,6 +287,12 @@ exports.loadStyle = function(tssFile) { // [ALOY-793] double-escape '\' in tss contents = contents.replace(/(\s)(\\+)(\s)/g, '$1$2$2$3'); + var regex = /@include[ \t]*[ \t]*['"](.*?)['"][ \t]*[ \t]*?;/; + while (match = regex.exec(contents)) { + var dir = path.dirname(tssFile); + contents = contents.replace(match[0], fs.readFileSync(path.join(dir, match[1]+ ".tss"))); + } + // Process tss file then convert to JSON var json; try { From c9815eb9aa03f47124eadffa1582ae040ae0a88c Mon Sep 17 00:00:00 2001 From: m1ga Date: Sat, 1 Jul 2023 21:03:54 +0200 Subject: [PATCH 2/3] feat: tss include --- Alloy/commands/compile/styler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Alloy/commands/compile/styler.js b/Alloy/commands/compile/styler.js index f19a47b3b..7cb9fdc54 100644 --- a/Alloy/commands/compile/styler.js +++ b/Alloy/commands/compile/styler.js @@ -287,6 +287,7 @@ exports.loadStyle = function(tssFile) { // [ALOY-793] double-escape '\' in tss contents = contents.replace(/(\s)(\\+)(\s)/g, '$1$2$2$3'); + // able to use "@include './file'" in a TSS file var regex = /@include[ \t]*[ \t]*['"](.*?)['"][ \t]*[ \t]*?;/; while (match = regex.exec(contents)) { var dir = path.dirname(tssFile); From 64bde56b5547766f16a2ea86a4105e220447d276 Mon Sep 17 00:00:00 2001 From: m1ga Date: Sat, 1 Jul 2023 21:08:53 +0200 Subject: [PATCH 3/3] lint --- Alloy/commands/compile/styler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Alloy/commands/compile/styler.js b/Alloy/commands/compile/styler.js index 7cb9fdc54..422c6a330 100644 --- a/Alloy/commands/compile/styler.js +++ b/Alloy/commands/compile/styler.js @@ -291,7 +291,7 @@ exports.loadStyle = function(tssFile) { var regex = /@include[ \t]*[ \t]*['"](.*?)['"][ \t]*[ \t]*?;/; while (match = regex.exec(contents)) { var dir = path.dirname(tssFile); - contents = contents.replace(match[0], fs.readFileSync(path.join(dir, match[1]+ ".tss"))); + contents = contents.replace(match[0], fs.readFileSync(path.join(dir, match[1] + '.tss'))); } // Process tss file then convert to JSON