zeplin / zeplin-extension-documentation

Documentation for Zeplin extensions ⚗️📚
234 stars 35 forks source link

How can we have Settings? #26

Closed morrislaptop closed 6 years ago

morrislaptop commented 6 years ago

Like in the Zeplin HTML and CSS extensions

berkcebi commented 6 years ago

Hey hey!

Sure, it's possible to define options in your package.json file: https://github.com/zeplin/zeplin-extension-documentation/blob/master/package.md#options--arrayoption …and here's an example: https://github.com/zeplin/react-native-extension/blob/develop/package.json#L31

Then in your code, you can query the option via context.getOption: https://github.com/zeplin/zeplin-extension-documentation/blob/master/model/context.md#contextgetoptionid--number—boolean—string

Hope this helps!