Issue: 3127

Where do custom directives belong?

[issue link]

I couldn’t find anything in the guide about a best practice on this. It seems a custom directive could be a plain old javascript file with the Vue.directive(...) syntax but I don’t see a clear winner for its directory or is the best practice to simply put the registration in the default.vue layout?

Just wanting to use this in my project:

// Register a global custom directive called `v-focus`
Vue.directive('focus', {
  // When the bound element is inserted into the DOM...
  inserted: function (el) {
    // Focus the element


This question is available on Nuxt.js community (#c2708)