0

My theme documention.libraries.yml file is defined as follows :

global-styling:
  version: VERSION
  css:
    base:
      styles/dist/styles.css: {}
tocbot:
  js:
    libraries/tocbot/tocbot.js: {}
    js/tocInit.js: {}
  css:
    layout:
      libraries/tocbot/tocbot.css: {}
layout_tweaksLib:
  js:
    js/layout_tweaks.js: {}

My custom module implements a custom template which also requires the theme functionality defined in tocInit.js. So I'm trying to include the tocbot library from my theme in my module.

I have tried including a dependencies clause in my_module.libraries.yml file, resulting in the following :

my_module:
  js:
    js/my-module.js: {}
  dependencies:
    - documentation/tocbot
  css:
    component:
      css/my-module.css: {}

However, the tocInit.js script is not being loaded on the modules' custom template.

I would appreciate some help, please.

0

From documentation.libraries.yml, extend the module's definition of the my_module library to include documentation/tocbot's assets using libraries-extend.

# documentation.libraries.yml
libraries-extend:
  my_module/my_module: 
    - documentation/tocbot

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.