Skip to content

Latest commit

 

History

History
executable file
·
87 lines (63 loc) · 2.47 KB

README.md

File metadata and controls

executable file
·
87 lines (63 loc) · 2.47 KB

@nuxtjs/moment

npm (scoped with tag) npm CircleCI Codecov Dependencies js-standard-style

Easily remove unused Moment.js locales in Nuxt.js projects using moment-locales-webpack-plugin.

Usage

yarn add moment @nuxtjs/moment OR npm i moment @nuxtjs/moment

Add @nuxtjs/moment to modules section of nuxt.config.js

To strip all locales except “en”:

{
  modules: [
    '@nuxtjs/moment',
 ]
}

Or to strip all locales except “en”, “es-us” and “fa“

{
  modules: [
    ['@nuxtjs/moment', ['fa']]
 ]
}

// or

{
  modules: [
    '@nuxtjs/moment'
  ],
  moment: {
    locales: ['fa']
  }
}

Note: “en” is built into Moment and can’t be removed)

Set default locale

You can set a default locale via the defaultLocale option. It must be included int the locales you keep (or 'en') and will only work when using the plugin option.

  modules: [
    ['@nuxtjs/moment', { locales: ['de'], defaultLocale: 'de' }]
 ]

Disable plugin

This module also registers a nuxt plugin to include all needed locales as well as injecting moment as $moment to Vue context. You can disable this behaviour using an object config:

  modules: [
    ['@nuxtjs/moment', { locales: ['es-us', 'ru'], plugin: false }]
 ]

Development

  • Clone this repository
  • Install dependnecies using yarn install or npm install
  • Start development server using npm run dev

License

MIT License

Thanks Ivan Akulov for making this awesome webpack plugin. 💖

Copyright (c) Nuxt Community.