From 106a9f061a9495717c890e53d5679856dd8d86c8 Mon Sep 17 00:00:00 2001 From: Aziz Ramdan Kurniawan Date: Thu, 18 May 2023 19:34:28 +0700 Subject: [PATCH] docs: fix the Registration Order Plugin with 'alphabetical' numbering --- docs/2.guide/2.directory-structure/1.plugins.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/2.guide/2.directory-structure/1.plugins.md b/docs/2.guide/2.directory-structure/1.plugins.md index 091b3e68a46a..32764378a418 100644 --- a/docs/2.guide/2.directory-structure/1.plugins.md +++ b/docs/2.guide/2.directory-structure/1.plugins.md @@ -67,20 +67,24 @@ If you are using an object-syntax plugin, the properties may be statically analy ## Plugin Registration Order -You can control the order in which plugins are registered by prefixing a number to the file names. +You can control the order in which plugins are registered by prefixing with 'alphabetical' numbering to the file names. For example: ```bash plugins/ - | - 1.myPlugin.ts - | - 2.myOtherPlugin.ts + | - 01.myPlugin.ts + | - 02.myOtherPlugin.ts ``` -In this example, `2.myOtherPlugin.ts` will be able to access anything that was injected by `1.myPlugin.ts`. +In this example, `02.myOtherPlugin.ts` will be able to access anything that was injected by `01.myPlugin.ts`. This is useful in situations where you have a plugin that depends on another plugin. +::alert{type=info icon=💡} +In case you're new to 'alphabetical' numbering, remember that filenames are sorted as strings, not as numeric values. For example, `10.myPlugin.ts` would come before `2.myOtherPlugin.ts`. This is why the example prefixes single digit numbers with `0`. +:: + ## Using Composables Within Plugins You can use [composables](/docs/guide/directory-structure/composables) within Nuxt plugins: