What is the Best way to load CSS for ACF Block wise?

Hello Guys!

Right Now I have More than 200+ Gutenerg ACF Block - https://nimb.ws/cIt2vS that is being used on the Whole site.

JSON Response - https://nimb.ws/OuSPNp

Issue: CSS by default loading of all the ACF blocks.

Desire: It should load CSS dynamically for rendered per ACF blocks only on Frontity.

Can you let me know How can I achieve that?


Hi @sanju.antala

Welcome to the Community!

With Frontity you can parse the HTML inserted into your React app and match specific patterns to detect tags and replace this portion of HTML with custom React components

This can be done via processors which are available in the html2react package

By using these processors you should be able to detect these ACF blocks from the HTML and replace them with custom React components with will have its own CSS styles via Styled components

Hope this helps