@nuxtjs/global-components

Module to register global components for Nuxt.js

NuxtJS Team released @nuxt/components to auto import components when used in templates, allowing better performances and features.
Last updated 9 months ago by ricardogobbosouza .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nuxtjs/global-components 
SYNC missed versions from official npm registry.

@nuxtjs/global-components

npm version npm downloads Circle CI Codecov License

Module to register global components for Nuxt.js

???? Release Notes

Usage

Suffix your components with .global.{ext} to declare your global components.

components/
  my-component.vue # local component, import it to use it
  my-button.global.vue # global component, no need to register it!

See live demo.

Setup

  1. Add @nuxtjs/global-components dependency to your project
yarn add --dev @nuxtjs/global-components # or npm install --save-dev @nuxtjs/global-components
  1. Add @nuxtjs/global-components to the buildModules section of nuxt.config.js
export default {
  buildModules: [
    // Simple usage
    '@nuxtjs/global-components',

    // With options
    ['@nuxtjs/global-components', { /* module options */ }]
  ]
}

:warning: If you are using Nuxt < v2.9 you have to install the module as a dependency (No --dev or --save-dev flags) and use modules section in nuxt.config.js instead of buildModules.

Using top level options

export default {
  buildModules: [
    '@nuxtjs/global-components'
  ],
  globalComponents: {
    /* module options */
  }
}

Options

dir

  • Type: String|Array
  • Default: components

A list of directories to find components inside your nuxt project.

suffixes

  • Type: Array
  • Default: ['global']

The suffixes that files can contain.

extensions

  • Type: Array
  • Default: ['vue', 'js', 'ts']

The extensions that files can contain.

ignore

  • Type: Array
  • Default: []

An array of glob patterns to exclude matches.

ignoreNameDetection

  • Type: Boolean
  • Default: false

Ignore name detection using prototype names.

License

MIT License

Insipired by nuxtjs.org

Copyright (c) Nuxt Community

Current Tags

  • 0.6.1                                ...           latest (9 months ago)

11 Versions

  • 0.6.1 [deprecated]           ...           9 months ago
  • 0.6.0 [deprecated]           ...           9 months ago
  • 0.5.1 [deprecated]           ...           9 months ago
  • 0.5.0 [deprecated]           ...           9 months ago
  • 0.4.1 [deprecated]           ...           9 months ago
  • 0.4.0 [deprecated]           ...           10 months ago
  • 0.3.1 [deprecated]           ...           10 months ago
  • 0.3.0 [deprecated]           ...           a year ago
  • 0.2.1 [deprecated]           ...           a year ago
  • 0.2.0 [deprecated]           ...           a year ago
  • 0.1.0 [deprecated]           ...           a year ago
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (10)

Copyright 2014 - 2016 © taobao.org |