This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Rohan K
Posted Feb 16 - Read on Facebook

since framer will not import sketch layers with same names (even if they are children of different layers) how can I target layer names with wildcards. For e.g. i was to use layer.childrenWithName(iconX) where iconX could be icon1, icon2, icon3 and so on...I know we use regex for wildcards and pattern matching, but I've always had a hard time understanding how to format and use regular expressions

5 Comments

Jonas Treub

Andreas built a component to target framer layers: https://github.com/awt2542/Find-for-Framer

Rohan K

thats a really cool module Andreas Wahlström! I am bookmarking this for future. However, for the task at hand, i am creating a reusable code snippet and I would much prefer to use a simpler version to just target the first child layer with the phrase "icon" or "text" in it. I just want to share this code as a snippet and don't want to also distribute the link to a module with it. Mind explaining how I can do that?

Jonas Treub

iconsLayers = sketch.parentLayer.children.filter (layer) => layer.name == "icon"

Rohan K

Should it be == or indexOf? will == be able to target icon1, icon2, etc?

Jonas Treub

In those cases you should use indexOf

Read the entire post on Facebook