Permalink
Browse files

Fix for missing children on flattened layers, move name sanitation to…

… sketch importer
  • Loading branch information...
Koen Bok
Koen Bok committed Dec 17, 2015
1 parent 920106e commit aefa54a9ddb245fae2bd8e209aa9ca5719137734
Showing with 4 additions and 7 deletions.
  1. +4 −7 framer/Importer.coffee
View
@@ -87,6 +87,10 @@ class exports.Importer
info.layerFrame = resizeFrame(@scale, info.layerFrame) if info.layerFrame
info.maskFrame = resizeFrame(@scale, info.maskFrame) if info.maskFrame
info.image.frame = resizeFrame(@scale, info.image.frame) if info.image?.frame?
# Flattened layers don't get children
if not info.children
info.children = []
LayerClass = Layer
@@ -128,13 +132,6 @@ class exports.Importer
if startsWithNumber(layerInfo.name)
throw new Error("(#{layerInfo.name}) Layer or Artboard names can not start with a number")
# Sanitize the layer names so mylayer.jpg gets converted to mylayer
for suffix in [".jpg", ".pdf"]
layerInfo.name = layerInfo.name.replace(suffix, "") if _.endsWith(layerInfo.name, suffix)
layerInfo.name = layerInfo.name.replace(suffix.toUpperCase(), "") if _.endsWith(layerInfo.name.toUpperCase(), suffix)
layerInfo.name = layerInfo.name.replace(/\W/g, "")
# We can create the layer here
layer = new LayerClass(layerInfo)
layer.name = layerInfo.name

0 comments on commit aefa54a

Please sign in to comment.