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

What is Framer? Join the Community
Return to index
Greg Woods
Posted Jul 08 - Read on Facebook

Hi guys,

It would be useful to be able to automatically generate shortened variable names for my layer groups imported from Sketch. The lists can be quite long when I do this and it takes a while to do them. How can I target the layer groups please. I assume it is a function with a loop?! Thanks for your advice.

demo = Framer.Importer.load "imported/wishlist_prototype5"

back_he = demo.back_he
cancel_create = demo.cancel_create
cancel_edit = demo.cancel_edit
close_ho = demo.close_ho
content = demo.content
curser = demo.curser
delete_list = demo.delete_list
done_create = demo.done_create


Benjamin Den Boer

Hey Greg Woods - there's a Utility called Utils.globalLayers() that you can call, which automatically does this for you. In your example, you can simply add the following line:


Keep in mind that if your layer group contains a reserved javascript keyword (function, for, class, etc), the editor will throw an error. :-)

Greg Woods

That is so useful, thanks

John Grendon Enderby

If using .globalLayers autocomplete doesn't work for variable names, would be awesome to build that in!

Read the entire post on Facebook