@@ -21,12 +21,12 @@ That said, preprocessing the full dictionary gives ultimate flexibility when nee
21
21
A preprocessor is an object with two props:
22
22
23
23
- ` name ` : the name of the preprocessor
24
- - ` preprocessor ` a callback function that receives the dictionary as a parameter , and returns the processed dictionary
24
+ - ` preprocessor ` a callback function that receives the dictionary and SD options as parameters , and returns the processed dictionary
25
25
26
26
``` javascript title="my-preprocessor.js"
27
27
const myPreprocessor = {
28
28
name: ' strip-third-party-meta' ,
29
- preprocessor : (dictionary ) => {
29
+ preprocessor : (dictionary , options ) => {
30
30
delete dictionary .thirdPartyMetadata ;
31
31
return dictionary;
32
32
},
@@ -38,7 +38,7 @@ Asynchronous callback functions are also supported, giving even more flexibility
38
38
``` javascript title="my-preprocessor-async.js"
39
39
const myPreprocessor = {
40
40
name: ' strip-props' ,
41
- preprocessor: async (dictionary ) => {
41
+ preprocessor: async (dictionary , options ) => {
42
42
const propsToDelete = await someAPICall ();
43
43
44
44
propsToDelete .forEach ((propName ) => {
@@ -112,7 +112,7 @@ Stripping description property recursively in the entire dictionary object:
112
112
``` js
113
113
StyleDictionary .registerPreprocessor ({
114
114
name: ' strip-descriptions' ,
115
- preprocessor : (dict ) => {
115
+ preprocessor : (dict , options ) => {
116
116
// recursively traverse token objects and delete description props
117
117
function removeDescription (slice ) {
118
118
delete slice .description ;
0 commit comments