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

5 Comments

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:

Utils.globalLayers(demo)

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

Rory Smyth

Utils.globalLayers should be in the docs. Its really useful

Greg Woods

That is so useful, thanks

Callil Capuozzo

I always forget this one too - so useful

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