Skip to content

Instantly share code, notes, and snippets.

@olehi94
Last active January 15, 2019 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olehi94/a894bf7436e230cc92ccd16098c4e165 to your computer and use it in GitHub Desktop.
Save olehi94/a894bf7436e230cc92ccd16098c4e165 to your computer and use it in GitHub Desktop.
Attaching JS assets into the <head> section

By default, Drupal, will attaches the JS assets at page bottom to avoid some frequents problems like: DOM content loading block, access to unready DOM element from jquery code, ecc... If for certain reason it's needed to attach JS assets into the section it's possible the use of header option, in this way:

  version: 1.x
  header: true
  js:
    js/cuddly-slider.js: {}

So, now, the js/curry-slider.js will be attached at page top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment