The Stack Overflow podcast is back! Listen to an interview with our new CEO.
2 This is what I've devised on my own for loading CSS files, for JS is pretty much similar.; added 91 characters in body
source | link

function wpdocs_theme_name_scripts() {

//this is example folder path $cssFolderPath = dirname(FILE)."/assets/css/";

 

function wpdocs_theme_name_scripts() {

    $cssFolderPath = dirname(__FILE__)."/check_for_additional_path_to_be_added/";

    $fileNames = array();
    foreach (new DirectoryIterator($cssFolderPath) as $file) {

        $filetype = pathinfo($file, PATHINFO_EXTENSION);

        if ($file->isFile>isFile() &&&& $filetype == "css") {

            array_push($fileNames, $file->getFilename>getFilename());
        }
    }

    foreach ($fileNames as $name){
        wp_enqueue_style( $name, "/wp-content/css_folder_pathplugin_or_theme_cssPath/".$name );
    }
}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

} add_action( 'wp_enqueue_scripts' This is what I've devised on my own for loading CSS files, 'wpdocs_theme_name_scripts' );for JS is pretty much similar.

function wpdocs_theme_name_scripts() {

//this is example folder path $cssFolderPath = dirname(FILE)."/assets/css/";

$fileNames = array();
foreach (new DirectoryIterator($cssFolderPath) as $file) {

    $filetype = pathinfo($file, PATHINFO_EXTENSION);

    if ($file->isFile() && $filetype == "css") {

        array_push($fileNames, $file->getFilename());
    }
}

foreach ($fileNames as $name){
    wp_enqueue_style( $name, "/wp-content/css_folder_path/".$name );
}

} add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

 

function wpdocs_theme_name_scripts() {

    $cssFolderPath = dirname(__FILE__)."/check_for_additional_path_to_be_added/";

    $fileNames = array();
    foreach (new DirectoryIterator($cssFolderPath) as $file) {

        $filetype = pathinfo($file, PATHINFO_EXTENSION);

        if ($file->isFile() && $filetype == "css") {

            array_push($fileNames, $file->getFilename());
        }
    }

    foreach ($fileNames as $name){
        wp_enqueue_style( $name, "/wp-content/plugin_or_theme_cssPath/".$name );
    }
}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

This is what I've devised on my own for loading CSS files, for JS is pretty much similar.

1
source | link

function wpdocs_theme_name_scripts() {

//this is example folder path $cssFolderPath = dirname(FILE)."/assets/css/";

$fileNames = array();
foreach (new DirectoryIterator($cssFolderPath) as $file) {

    $filetype = pathinfo($file, PATHINFO_EXTENSION);

    if ($file->isFile() && $filetype == "css") {

        array_push($fileNames, $file->getFilename());
    }
}

foreach ($fileNames as $name){
    wp_enqueue_style( $name, "/wp-content/css_folder_path/".$name );
}

} add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );