Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not read generated file with layer style. TypeError: Cannot read property 'MSAttributedStringColorAttribute' of undefined #139

Open
Koshub opened this issue Aug 29, 2020 · 0 comments

Comments

@Koshub
Copy link

Koshub commented Aug 29, 2020

Hello. Reading generated file with a shared layer style produces an error.

if (fs.existsSync(path)) {
  Sketch.fromFile(path)
  .then(sketch => {
    console.log(sketch)
  })
  .catch(error => console.log(error))    
} else {
  const sketch = new Sketch()
  sketch.addLayerStyle({
    name: 'Test Layer Style',
    fills: [
      {
        color: '#008AE7'
      }
    ],
    borders: [
      {
        color: '#859099'
      }
    ]        
  })
  sketch.build(path)
}

Error on reading:

TypeError: Cannot read property 'MSAttributedStringColorAttribute' of undefined
    at new TextStyle (/node_modules/sketch-constructor/models/TextStyle/TextStyle.js:56:32)
    at new Style (/node_modules/sketch-constructor/models/Style/Style.js:81:44)
    at new SharedStyle (/node_modules/sketch-constructor/models/SharedStyle/SharedStyle.js:42:20)
    at /node_modules/sketch-constructor/models/Document/Document.js:68:80
    at Array.map (<anonymous>)
    at new Document (/node_modules/sketch-constructor/models/Document/Document.js:68:59)
    at /node_modules/sketch-constructor/models/Sketch/Sketch.js:39:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant