From 756bc650b124c215b1693cd85e940ec84ed0c37c Mon Sep 17 00:00:00 2001 From: Teemu Taskula Date: Mon, 13 Nov 2023 13:28:32 +0200 Subject: [PATCH] Fix tokenizing when only nodeId tokens are defined --- src/tokenizer.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tokenizer.js b/src/tokenizer.js index aa65d6d..564f98b 100644 --- a/src/tokenizer.js +++ b/src/tokenizer.js @@ -30,6 +30,15 @@ export default class Tokenizer { } async handleStyles() { + const customTokens = this.config.tokenize.tokens.filter((t) => + Boolean(t.nodeId) + ); + + // If there are no style tokens, return early + if (this.config.tokenize.tokens.length === customTokens.length) { + return; + } + const styles = await this.figmaAPI.fetchStyles(); const stylesById = styles.reduce((acc, style) => {