The theme I am using already calls the wp_enqueue_style
function to enqueue a css file.
I want to whether it is possible to change the css file path before it is actually outputted on the page.
Why I want to do this?
Basically, I want to check if it is a dev or prod environment. Based on that I want to include either the uncompressed or compressed file.
I wonder if you are looking for the style_loader_src
filter?
For example:
add_filter( 'style_loader_src',
function ( $src ){
// ... your stuff ...
return $src;
}
);
Similarly there exists the script_loader_src
filter.
There’s also the base_url
property of the global $wp_scripts
and $wp_styles
objects, but I think that’s only used for enqueued native styles and scripts.