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

What is Framer? Join the Community
Return to index
Koen Bok
Posted Feb 01 - Read on Facebook

Two new beta features to test for you guys. If you want to try them do "File > Update Framer" in your app. Please be aware that these may change or break.

---

Utils.globalLayers(<layers>) makes all your imported layers global so you can use myLayer instead of importedDoc.myLayer. It will not overwrite existing variables but throw warnings instead so that you won't accidentally override window or document (and break everything).

http://share.framerjs.com/kwmwgs0aan1r/

---

Utils.textSize(text, style, {width:n, height:n}) is a way to calculate text size. Handy if you need to do a layout that depends on the height of a title for example. You can constrain either the width or height of the text.

http://share.framerjs.com/fl5f73vz1ei8/

3 Comments

Chris Lee

I was thinking an alternative option for global layers would be to use CoffeeScript destructuring for the import statement, prepopulated with all the layer names.

Ex:
{App, TabBar, Content} = Framer.Importer.load "imported/demo"

This would give a quick way to know from reading the code all the layers that are available and prepopulate them in the autocomplete.

The downside is that it's more code. Just a thought!

Koen Bok

Yeah and the biggest worry for me is that if you override common names like window, Image, Text you break everything and it's hard to find out why.

Jordan Robert Dobson

I wish there was a similar way to import components (Layers and their Sub Layers) or elements that aren't just images from an external file.

Read the entire post on Facebook