I have developed a custom WordPress theme with an extensive amount of code. To manage the numerous style
and script
files, I have segmented them into multiple individual files.
To integrate all these files into my template, I utilized the following code within the function file:
add_action( 'wp_enqueue_scripts', 'files_assets' );
function files_assets() {
// Adding CSS files
wp_enqueue_style( 'Bootstrap-min', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '4.0.0' );
// Adding JS files
wp_enqueue_script( 'jQuery3.4.1', get_template_directory_uri() . '/js/jquery-3.4.1.min.js', array( 'jquery' ), '1.4.1', true );
}
With a total of 61 style and script files, it has become challenging to introduce each one individually using the aforementioned code.
Is there an efficient method to streamline this process by creating an all.css
file containing all styles and linking only this file to my template?
Similarly, is there a way to consolidate all script files into an all.js
file for simpler integration?