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

What is Framer? Join the Community
Return to index
Benjamin Udink ten Cate
Posted Jul 13 - Read on Facebook

Is there an easy way to select sublayers of a imported sketch file? right now I made a small function to do so:

find_in_sublayer = (parent, name) -> (parent.subLayers.filter (i) -> is name)[0]

I did this because sketch.plan.stats.x would give a error (undefined is not a object) but if I do find_in_sublayer(sketch.plan, 'stats').x = 100 it all works perfectly.


Anton Jarl

Or just stats.x = 100?

Julian Veerkamp

I don't think that'll work. as far as I understand it you can't reference a sublayer with sketch.parent.layer
Sadly, it would make things much easier. What you could do would be:
sketch.plan.sublayer[0].x = 100

Benjamin Udink ten Cate

for anyone who comes across this issue. Rename the layers in sketch(if they have no unique names) and target them directly, so sketch.stats in this case

Menno Schellekens

Benjamin, I use Sketch symbols across the artboards. Can I give unique names to symbols?

Anton Jarl

Menno Yes!

Read the entire post on Facebook