0

I have recently noticed that Drupal8 is adding number of JavaScript files. I would like to know if it is necessary for theme to function

<script src="/core/assets/vendor/domready/ready.min.js?v=1.0.8"></script>
<script src="/core/assets/vendor/jquery/jquery.min.js?v=2.2.4"></script>
<script src="/core/misc/drupalSettingsLoader.js?v=8.3.7"></script>
<script src="/core/misc/drupal.js?v=8.3.7"></script>
<script src="/core/misc/drupal.init.js?v=8.3.7"></script>

My theme does not use any of them. I would like them to be removed. Can anyone here tell me how to remove them?

  • 1
    It's impossible to answer this without knowing what theme you're using. Once you've identified your theme, you'll be able to look at its THEMENAME.libraries.yml file, which will tell you all the libraries it implements, and what dependencies those have. Keep in mind that it might be a module (core, contrib or custom) that adds the libraries, and subsequently the scripts you're seeing, so it may have nothing to do with the theme – Clive Sep 27 '17 at 18:33
  • My theme does not use it but it got added automatically. I would like them to be removed. Do you know how? – forethought Sep 27 '17 at 18:35
  • Are you sure the theme doesn't use them? How have you checked? Getting rid of them isn't as straightforward as all that, ideally you'd want to identify which module has added them in the first place, and what for, and then decide whether or not you still need them – Clive Sep 27 '17 at 18:36
  • i went to my theme *.libraries.yml file and checked it there. It is added by core.libraries.yml. – forethought Sep 27 '17 at 18:39
  • 1
    No that's just where the individual libraries are registered with the system. Adding them to a page happens elsewhere, based on what a particular module or theme needs to do on a particular page. For example, if you have the admin toolbar enabled, that will include backbone, drupal, drupalSettings and a bunch of other things, but only on pages where the toolbar is rendered. You need to find out what you have enabled that depends on those libraries, or what code is specifically adding every single one of them manually to every page. I'd bet on it being the former – Clive Sep 27 '17 at 18:42
0

In your .info.yml file specify:

libraries-override: core/drupal.active-link: false

You may have to remove more libraries, but this one is specifically for the files you mentioned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.