-3

I am trying to load an external CSS file to globally effect my website.

I have tried the following in /core/themes/olivero/olivero.libraries.yml but no change occured after cache rebuild.

global-styling:
  version: VERSION
  css:
    base:
      css/base/fonts.css: {}
      css/base/base.css: {}
      css/base/utility.css: {}
      css/base/https://raw.githubusercontent.com/USER/REPOSITORY/main/website/style.css: { type: external, minified: false}

Removing css/base/ from before the URL doesn't matter.

Why does the external CSS file isn't loaded?

4

1 Answer 1

0

This:

global-styling:
  version: VERSION
  css:
    base:
      css/base/fonts.css: {}
      css/base/base.css: {}
      css/base/utility.css: {}
      css/base/https://raw.githubusercontent.com/USER/REPOSITORY/main/website/style.css: { type: external, minified: false}

Should be this:

global-styling:
  version: VERSION
  css:
    base:
      css/base/fonts.css: {}
      css/base/base.css: {}
      css/base/utility.css: {}
      //raw.githubusercontent.com/USER/REPOSITORY/main/website/style.css: { type: external, minified: false}

Make sure you clear the registry when you're done. If it doesn't load, look at the HTML source, and show us what is being loaded.

2
  • From Developer tools >> Network >> CSS, this file, alongside other CSS files from Drupal itself, is now being loaded (thereofre I gladly accepted the answer). But for some reason the CSS in that particular file, which is * {display: none !important;} doesn't effect the website at all (after cache rebuild from Drush), i.e. it doesn't override all Drupal-original CSS files, those from core, and those from Asset Injector module.
    – themer
    Commented Jul 23, 2023 at 15:42
  • Sounds like a different problem.
    – Jaypan
    Commented Jul 23, 2023 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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