1

I'm experiencing a weird problem. I'm making a sub-theme of the Bootstrap theme that's available for Drupal 8. However, after trying all the possible ways of how to attach a library to a page in my theme, no one seems to work. Am I doin'g something wrong?

Here's my libraries.yml file

countdown-timer:
version: VERSION
js:
  js/jquery.countdown.min.js: {}
  js/auction-timer.js: {}

Here's how I am trying to attach it to all pages in .info.yml

libraries:
  - numisvet/countdown-timer

I have already tried the approach of adding '#attached' to the render array or using {{ attach_library('numisvet/countdown-timer') }} in a twig file.

No one of these seems to work, only libraries defined by the Bootstrap theme are getting loaded.

Am I doing something wrong? Thanks a lot for all replies.

1
  • Make sure the yml spacing/indentation is correct. Also, after attaching, clear the cache. – Kevin Dec 12 '16 at 14:21
0

Simply add your library here in your's my libraries.yml file

 bootstrap-scripts:
 js:
bootstrap/js/affix.js: {}
bootstrap/js/alert.js: {}
bootstrap/js/button.js: {}
bootstrap/js/carousel.js: {}
bootstrap/js/collapse.js: {}
bootstrap/js/dropdown.js: {}
bootstrap/js/modal.js: {}
bootstrap/js/tooltip.js: {}
bootstrap/js/popover.js: {}
bootstrap/js/scrollspy.js: {}
bootstrap/js/tab.js: {}
bootstrap/js/transition.js: {}
bootstrap/js/transition.js: {}

Your-sub-theme/js/jquery.countdown.min.js: {}

Your-sub-theme/js/auction-timer.js: {}

**No need to define it separately also place your js file at correct folder path should be eg:Your-sub-theme/js/jquery.countdown.min.js then clear cache **.

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.