I noticed that only on all single blog post pages, main.js was not being included as a script tag in the head. Example page:
https://accountability-framework.org/how-to-bake-an-ethical-cookie/
And I’m trying to determine why.
In our layouts/app.blade.php we have:
@include('partials.head')
which I gather brings in partials/head.blade.php which contains:
@php wp_head() @endphp
which I gather brings in app/setup.php which contains:
add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('sage/main.css', asset_path('styles/main.css'), false, null);
wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery'], null, true);
wp_localize_script( 'sage/main.js', 'ajax_obj', array(
'url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('ajax_nonce')
) );
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}, 100);
which, according to this:
I thought would include main.js in every template that has:
@extends('layouts.app')
which is the case for all our templates as far as I can tell.
For example,
template-blog.blade.php
template-custom.blade.php
single.blade.php
all contain @extends('layouts.app')
Also note that we don’t appear to have these files:
layouts/base.blade.php
resources/views/index.blade.php
Any ideas as to why main.js is not present only on single blog post pages?