Constructor
new Sketch()
- Source:
Properties:
Name |
Type |
Description |
repo |
JSZip
|
The instance of JSZip containing the raw data |
document |
Node
|
The document data |
meta |
Node
|
The meta data |
user |
Node
|
The user data |
pages |
Array.<Page>
|
Array with all pages of the document |
symbolsPage |
Page
|
undefined
|
The "Symbols" page if exists |
localSymbols |
Array.<Node>
|
Array with all local symbols (symbols stored in any page of the document) |
foreignSymbols |
Array.<Node>
|
Array with all foreign symbols used in the document (symbols loaded from libraries) |
sharedStyles |
Array.<SharedStyle>
|
Array with all shared styles of the document |
textStyles |
Array.<SharedStyle>
|
Array with all text styles of the document |
colors |
Array.<Node>
|
Array with the document color palette |
gradients |
Array.<Node>
|
Array with the document gradients palette |
Methods
save(file) → {this}
- Source:
Save the document as a sketch file
Example
ns.read('input.sketch').then((sketch) => {
//modify the sketch data
return sketch.save('output.sketch')
})
Parameters:
Name |
Type |
Description |
file |
string
|
The file path |
Returns:
-
Type
-
this
use(plugin) → {this}
- Source:
Execute a plugin with the sketch
Parameters:
Name |
Type |
Description |
plugin |
function
|
The plugin to execute |
Returns:
-
Type
-
this