First I apologize if I'm not clear but I'll try to explain my problem with my enqueue script.

I am trying to build a WP theme (conveting HTML & CSS Website) with existing files, but when I try to enqueue the script.min.js into footer, WP automatically add another file into footer with script.min.css. Any help on explaining what is happening?

functions.php

    function egothix_script_enqueue() {

    wp_enqueue_style('vendors', get_template_directory_uri().'/css/vendors.min.css', array(), '1.0.0', 'all');
    wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/main.css', array(), '1.0.0', 'all');

    // wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.6', 'all');
    // wp_enqueue_script('jquery');
    wp_enqueue_script('scripts.js', get_template_directory_uri() . '/js/scripts.min.js', array(), '2.0.0', true);
    // wp_enqueue_script( 'scripts.js' );
}
add_action( 'wp_enqueue_scripts', 'egothix_script_enqueue');

screenshot of my issue

Thnx in advance,

  • 3
    @GavinSimpson. Note scripts.min.css is NOT in his code... Drilon, does your js have a request for that css? Does the css go away if you don't enqueue the js? – rudtek Dec 3 at 15:56
  • Hi @rudtek.... First my js doesn't have a request for that css and it does go away when I don't enqueue the scripts.min.js into my function. – Drilon Byci Dec 4 at 9:20
  • What is in scripts.min.js? – Jacob Peattie Dec 4 at 12:08
  • Is it maybe loaded from the themes footer.php or maybe even from a plugin? If not, could you kindly post the contents of the scripts.min.js (un-minified if possible haha) so we can have a look if there is some kind of request? – marvinpoo Dec 4 at 14:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.