Like Chrome extensions, but for your Nuxt.js environments.
Like Chrome extensions, but for your Nuxt.js environments.
API?
Local netork?
(apart from next level developer experience, ofc.)
a.k.a. lihbr
Beginner friendly~
Modules are Nuxt.js extensions which can extend its core functionality and add endless integrations.
Nuxt Modules are registered inside your Nuxt config file:
// nuxt.config.js
export default {
modules: [
"@nuxtjs/pwa",
"~/modules/my-module",
["@nuxtjs/prismic", { /* ... */ }],
],
buildModules: [/* works the same way */],
};
A Nuxt module is a function:
// ~/modules/my-module
export default function (moduleOptions) {
// Options provided to the module...
console.log(moduleOptions);
// Nuxt instance
console.log(this);
}
(finally)
Global modules have no impact on the codebase nor the final website.
-^
Global modules work transparently across all Nuxt projects on your computer.
A Chrome extension personalizes your experience on every website you visit.
-^
A global module personalizes your experience on every Nuxt project you work on.
Enlighten your Nuxt experience
A hypothetical Google Analytics module:
…and jump to some code~
~/.nuxtrc
nuxt.config.js
~/.nuxtrc
rc9
bin
config of package.json
:{
"bin": {
"module-docs": "./bin/cli.js"
}
}
#!/usr/bin/env node
// CLI code...
Regular module
Global module
npm install --global @lihbr/module-docs && module-docs
.nuxtrc
fileLike Chrome extensions, but for your Nuxt.js environments.
Everything from this talk & more:
My blog:
Twitter: