1

I'm a very beginner in drupal and I just want to add a css file to my custom theme.

So I created a upjv.libraries.yml in themes/upjv and I added :

global-styling:
version: '8.4.4'
css:
   theme:
       css/styles-upjv.css: {}

And I have created a styles-upjv.css in themes/upjv/css. On my index page, my file isn't loaded and I don't know if it's because I created the file in a wrong place, if the content of my libraries.yml is correct. Can anyone help me on this little problem please ?

1 Answer 1

3

You have to add the following in your upjv.info.yml:

libraries: 
  - upjv/global-styling

Make sure to clear cache after that by navigating to configuration > Development > Performance then clicking on Clear all caches under CLEAR CACHE.

4
  • Thanks for your anwser, I added it but it still doesn't work
    – Erlaunis
    Commented May 3, 2018 at 17:30
  • Do I have to add something in the backend ? Is there any log managed by drupal ?
    – Erlaunis
    Commented May 3, 2018 at 17:33
  • Did you clear caches? I added the details on how to do that. Let me know if you still need help.
    – Sheedo
    Commented May 3, 2018 at 17:51
  • See Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 theme on drupal.org.
    – sonfd
    Commented May 4, 2018 at 3:38

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.