Hi Folks.
I’m trying to get proper structure in Sage10 to work with Gutenberg Blocks. I know that originally they are planned to be as Plugin, but in my cases blocks are strongly connected with Theme and I don’t see the point to separate them.
Ok, I know that there is @tinypixelco/laravel-mix-wp-blocks, but what next? Let’s say for example I have a website where I need to make 30-50 custom tailored blocks for that website.
- What structure for that should I use?
Should I make:
/resources/scripts/blocks/block-name-1/index.js & edit.js & save.js
/resources/scripts/blocks/block-name-2/index.js & edit.js & save.js
and import index.js files in editor.js each by each?
-
What when there is front-end js? make a file script.js in block folder and import to app.js?
-
What with .scss import to index.js? (Also wondering what is the reason? Could someone explain?)
-
For CSS I would probably use /resources/styles/blocks/block-name-1.scss & block-name-2.scss and import them using https://www.npmjs.com/package/import-glob-loader .
-
I was wondering about using FS (Or there is something better?) to get importing blocks to editor.js automatically if file/folder exist, anyone got good trick for that?
Thank you!