The project setup with Sage is quite new to me and just figuring things out and looking for a little advice on best practice.
I’ve investigated Gutenberg blocks with ACF which seems great! This isn’t appropriate in this instance as the element I’m making is not to appear within the page content. But looking at this neat ACF solution sage-acf-gutenberg-blocks I noticed that the style for the block is just rendered with the block.
<blockquote data-{{ $block['id'] }} class="{{ $block['classes'] }}">
<p>{{ get_field('testimonial') }}</p>
<cite>
<span>{{ get_field('author') }}</span>
</cite>
<style type="text/css">
[data-{{$block['id']}}] {
background: {{ get_field('background_color') }};
color: {{ get_field('text_color') }};
}
</style>
In my implementation, I’m making partials that are used at the bottom of certain page templates. Is this also what you would do for CSS in this instance? Or is there another, better way? I’ve just been experimenting with adding .js files and I like the way these can use DOM based routing based on the body class and wonder if there is a similar type of thing for CSS. Advice much appreciated!