Skip to content

Commit

Permalink
feat: add feature to ignore frame in figma
Browse files Browse the repository at this point in the history
  • Loading branch information
feerglas committed Aug 25, 2020
1 parent 303fb5f commit 76c0f38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions figmaExtractor/figmaExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const config = {
fontSize: 'fontSize'
}
},
frameIgnorePattern: '***ignore***',
output: {
folder: 'properties'
}
Expand Down
9 changes: 7 additions & 2 deletions figmaExtractor/figmaFrames.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const shouldIgnoreFrame = (frame, config) => frame.name.indexOf(config.frameIgnorePattern) !== -1;

// Get frames from 1st page of the Figma file
module.exports = (figmaData, config) => {

Expand Down Expand Up @@ -31,11 +33,14 @@ module.exports = (figmaData, config) => {
}

const figmaFrames = children.filter((frame) => frame.type === config.figma.childTypes.frame);
const onlyNotIgnoredFrames = figmaFrames.filter((frame) => !shouldIgnoreFrame(frame, config));

if (figmaFrames.length < 1) {
if (onlyNotIgnoredFrames.length < 1) {
throw new Error('ERROR: 1st page of the Figma file does not have any frames');
}

return figmaFrames;
console.log(onlyNotIgnoredFrames);

return onlyNotIgnoredFrames;

}

0 comments on commit 76c0f38

Please sign in to comment.