bomberstudios / sketch-framer

A Sketch plugin to easily export your mockups to FramerJS
Other
767 stars 67 forks source link

Asterisk in layer names. #60

Closed SciutoAlex closed 10 years ago

SciutoAlex commented 10 years ago

Because the Sketch-to-Framer is pretty shaky, I've been liberally flattening layers by appending a * to the Sketch layer name. The problem is that when I want to use the flattened layers, I have to say myLayers['flattened'] because myLayers.flattened throws and error obviously.

Does it make sense to strip out the asterisk? I can see arguments against stripping, but I thought I'd let you know it's an issue I've run up against.

And I've been using this loop to fix it:

/*Because Framer currently includes the * for flattened layers, we need to remove them*/
for(var i in myLayers) {
    if(i.slice(-1) == "*") {
        var newName = i.slice(0, i.length-1);
        window[newName] = myLayers[i];   #in keeping with using framer shortcuts which move all layers to the global namespace.
    }
}
bomberstudios commented 10 years ago

How are you exporting? This was fixed some time ago: https://github.com/bomberstudios/sketch-framer-3/issues/15

SciutoAlex commented 10 years ago

Hmmmm. I'm using the Framer Generator app. I haven't been using the plugin. Do you suggest I go back to the plugin?

bomberstudios commented 10 years ago

Framer Generator uses the plugin internally. I'll check with them what's going on here : )