I have a third party library located in the root/libraries directory, but it is not called on my webpage. I was wondering using subtheme/subtheme.theme or subtheme.libraries.yml. I call it from here? Any information would be great, I can't find documentation on third party libraries for Drupal 8.

  • You have to define it in theme.libraries.yml and either attach it with a hook or include it by default in theme.info.yml.
    – Kevin
    Commented Mar 15, 2018 at 17:28
  • @Kevin when I add the library to theme.libraries.yml I get an error on my page. The way I call it is as follows, swiper: (newline, space & 3 line indent) js: /libraries/slick/slick/slick.min.js . Am I not allowed to call a file outside the scope of the subtheme? Commented Mar 15, 2018 at 17:52

1 Answer 1


You can add your library in your file theme.libraries.yml (or module.libraries.yml) like this:

# Parsley use for contact_form.
    dist/js/vendors/parsley.min.js: { minified: true }
    - core/jquery

After, you can include your library like any other libraries with a hook or a template.

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.