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

What is Framer? Join the Community
Return to index
Rich Cornish
Posted Dec 30 - Read on Facebook

This is going to sound dumb, but how does one target a layer imported from Sketch/PS? You have navLayers = Framer.Importer.load "imported/nav". Now what? Nothing on the website actually walks you through just a basic import process. http://framer.com/learn/import/photoshop-and-sketch/ has a little, then it stops, and you get the reference docs...? Why isn't this basic information on the website?

12 Comments

Stephen Crowley

navlayers["layername"]

Stephen Crowley

Is b1 a group name in your sketch project?

Joshua Tucker

You can also do navLayers."layername".

One thing I recommend that makes it SO much easier to target layers is to use the Shortcuts for Framer from Facebook (https://github.com/facebook/shortcuts-for-framer).

In the General section, it talks about how to setup your environment to allow you to target the layers just by their name, instead of having to do navLayers."layername", or as Stephen Crowley said, navLayers["layer name"].

Note that it can cause issues if you have multiple groups that are named the same (even sublayers) so be wary of that. Also, some names might be reserved for methods in code, so be aware of that too (haven't run into too many – one example is naming a group "Date").

Stephen Crowley

I was hoping to include the Shortcuts for Framer link when I got home, thanks for shedding some light on it Joshua! I recall Koen mentioning that you just have to be careful on the layer name when using the shortcut.

Joshua Tucker

Stephen Crowley For sure! And yes, I described that a bit at the bottom of my post above :).

Joshua Tucker

Rich Cornish Is "b1" a layer in PS or a group called "b1" with the layer in it?

Joshua Tucker

Sorry - should have thought to ask :). Sketch for the win. In regards to folders, layers have to be in folders. I'll post a screenshot of a project I'm working on to show you an example:

To use the folder Cells as an example, I can target just Cells and change properties that would affect all my subgroups inside Cells. If I were to target say sortRectLayer, I could change only its properties. However, the actual layer sortRect is not a layer in Framer.

Now, if you were to target your Artboard1, you could could change properties for all your groups at once.

Stephen Crowley

Whoops that's what I get for reading on the go. 😜

Joshua Tucker

That's correct.

Metin Saray

for layerGroupName of myLayers
window[layerGroupName] = myLayers[layerGroupName]

Try using this than you can call any objects only by its name without = myLayers['somelayer']

Joshua Tucker

Rich Cornish Anytime! Can't wait to see your creation.

Alexis Morin

Rich, only Sketch/Photoshop groups can be accessed via code in Framer. you can then access them with navlayers['b1'] or navlayers.b1

Read the entire post on Facebook