(My) Plugin boilerplate

I just wanted to announce that I’ve just open-sourced a boilerplate/template for new plugins, which I’ve set up over time and which now is my “go-to” boilerplate for new plugins.

It supports JavaScript-autocompletion in VSCode and JetBrains WebStorm (with the help of the typings, which will – since I’m currently the person updating the typings – will always be kept up to date in the template as well) and has Webpack (with npm) as well as ESLint preconfigured, so you can also use modules from npm etc.

I’m in no way saying it’s a “perfect” template or anything (and I’m really not trying to create some sort of standard or anything like that – I just wanted to make this open-source in case somebody find it useful). It’s just my go-to template for new plugins and a result of what I’ve learned about plugin development since joining the Beta :wink:.

One important recommendation: If you use the template, don’t do everything in the src/main.js. Instead, create a folder structure that represents your plugin. Personally, I always use a dialogs folder where all my dialogs exist in different JS files, a functions folder with all the scenegraph-manipulating functions called after the dialogs and a helpers folder with everything I need in different places. I’m not saying you should use the same folder structure, but just don’t use 1000 line JS files – you won’t gain any performance by that since Webpack will compile it down to a single file anyway :laughing:

Feel free to use the boilerplate if you want to – maybe someone will find it useful :wink: – you can find it at https://github.com/pklaschka/xd-plugin-boilerplate and usage instructions are in its REAME.md

6 Likes

I’ve now integrated the updated version of the typings (matching the XD-15 APIs, where the XD update was released yesterday).

3 Likes