@@ -25,14 +25,14 @@ A tiny (< 1KB) utility library that transforms the Figma API response into somet
25
25
import processFile from ' figma-transformer' ;
26
26
27
27
// Fetch the file you want using your favourite method
28
- ...
28
+ const originalFile = fetchFigmaFile ();
29
29
30
- const fileData = processFile (originalFile);
30
+ const file = processFile (originalFile);
31
31
32
- // ✨ You can now use `fileData ` for whatever you need! ✨
32
+ // ✨ You can now use `file ` for whatever you need! ✨
33
33
34
34
// Let's get the styles for a component named "Test"
35
- const testStyles = data .shortcuts .components
35
+ const testStyles = file .shortcuts .components
36
36
.find (component => component .name === " Test" )
37
37
.shortcuts .styles ;
38
38
@@ -255,21 +255,21 @@ Let's see more specific examples where the benefits of the library really stand
255
255
** Getting all text used in a document**
256
256
257
257
``` js
258
- const text = data .shortcuts .texts .map (node => node .characters );
258
+ const text = file .shortcuts .texts .map (node => node .characters );
259
259
```
260
260
261
261
** Finding the styles applied to a specific component**
262
262
263
263
``` js
264
- const styles = data .shortcuts .components
264
+ const styles = file .shortcuts .components
265
265
.filter (component => component .name === " Test" )
266
266
.map (component => component .shortcuts .styles );
267
267
```
268
268
269
269
** Getting the fill colours for all the rectangles in the first page**
270
270
271
271
``` js
272
- const fills = data .shortcuts .pages
272
+ const fills = file .shortcuts .pages
273
273
.filter (page => page .name === " Page 1" )
274
274
.map (page => page .shortcuts .rectangles .fills );
275
275
```
0 commit comments