My site has a structure essentially
blocks
— my-first-block
— block.json
— style.scss
— style.css
— template.php
— my-second-block
— block.json
— style.scss
— style.css
— template.php
which is a very good way to product templating blocks for a website and, in the backend, I don’t mind that there’s a CSS file for each block
but in the front end, I now have a CSS file for every individual block.
So, the thing I would like to do is keep this way of working in the backend (maybe) but have a single file of all CSS
THere is a long winded way, that in my style.scss I have many import statements
import ‘blocks/my-first-block/style.scss’;
import ‘blocks/my-second-block/style.scss’;
…
In a theme that has 40 blocks this is a bit clunky.
In my block.json the statement that controls the CSS is
"style": [ "banner-generic" ],
…which appears to refer to style.css in the folder /blocks/banner-generic. BUt as I’m only learning I’m not entirely sure how this work.
Any ideas or links to resources?
I got the initial method from
https://www.billerickson.net/building-acf-blocks-with-block-json/
but that only goes so far.