CSS for wp-components in blocks
-
Hello!
i am experimenting with building blocks that render on the frontend using “render” and “viewScript” in block.json
My goal is to use elements from the @wordpress/components package, such as a button for example.
I don’t want to do anything with edit.js yet, I’m only interested in the frontend. The button displays, but without CSS.
The documentation states that I should add wp-component dependencies to the plugin stylesheet and it works when I add this to my theme in style registering stuff :wp_register_style('my_theme', get_theme_file_uri('assets/css/index.css'), array('wp-components'));
and this is where I start to get lost and confused because I need to go with styling outside the block.
Here are my two questions:- How and where can I correctly upload styles for wp-components displayed only on the frontend for blocks?
- What is the correct way to do custom CSS for these elements? Is it possible?
Please help or advise!
- The topic ‘CSS for wp-components in blocks’ is closed to new replies.