From 9f08ca31e6f0b89ac45bf52983f1730dbe16b2b9 Mon Sep 17 00:00:00 2001 From: Alex Bueno <44420072+aweell@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:24:11 +0200 Subject: [PATCH] Handle scopes for gradient variables --- tokens/figma/update-middleware.mjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tokens/figma/update-middleware.mjs b/tokens/figma/update-middleware.mjs index 1e3e42349f..01e727540a 100644 --- a/tokens/figma/update-middleware.mjs +++ b/tokens/figma/update-middleware.mjs @@ -332,10 +332,19 @@ async function updateBrandCollection( variableName, brandMap, ] of variableToBrandMap) { + // Return empty scopes in gradient variables, since they already have a style + let scopes = [VARIABLE_SCOPES.ALL_SCOPES]; + + const stopRegex = /-stop-\d+$/; + + if (stopRegex.test(variableName)) { + scopes = []; + } + const variable = { name: variableName, resolvedType: VARIABLE_TYPES.COLOR, - scopes: [VARIABLE_SCOPES.ALL_SCOPES], + scopes: scopes, targetCollectionName: COLLECTION_NAMES.SKIN, };