Add wp_add_inline_style into another wp_add_inline_style for better performance

function loadOneStylePage(){
  wp_enqueue_style( 'main-style', get_template_directory_uri() . '/styles/main.css', array(), _S_VERSION );
  wp_enqueue_style( 'main-style-separate-file', get_template_directory_uri() . '/styles/main.css', array(), _S_VERSION );
  
  //i would like to merge the two files?
  wp_add_inline_style( 'main-style-separate-file', 'main-style' );
}
add_action('wp-enquueue_scripts', 'loadOneStylePage');

Ideally, I would like to put these two together as 1 file. I know i can merely edit the single file and plainly add all the css together but for the sake of creating a custom theme and providing additional options is never bad.

I know the wp_add_inline_style api merges inline styling but is there a way to merge actual files?

Topic wp-enqueue-style Wordpress

Category Web


No, there’s no function to merge files like that. If you want a single CSS file you need to make a single CSS file.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.