Attaching JS and CSS Assets in Drupal 8
Drupal 8 has introduced a different way of attaching JavaScript and CSS to themes and custom modules via a new concept called libraries, which are covered in Day 9. Libraries are essentially .yml files that define different groups of assets that can later be attached via module code. When I started working with the theme layer in Drupal 8, I quickly realized that certain things are very different from Drupal 7. One of the main gotchas for anyone new to Drupal 8 is the idea that JavaScript libraries are now only loaded where they are needed. In contrast to Drupal 7 where jQuery for example, was loaded on every page, in Drupal 8 jQuery is no longer automatically loaded. This provides for a better optimized site with only the required libraries included in areas that they are needed. ...