Skip to content

Easily remove unused Moment.js locales in Nuxt.js projects

License

Notifications You must be signed in to change notification settings

Pickaw/moment-module

This branch is 4 commits ahead of, 44 commits behind nuxt-community/moment-module:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d1256a6 · Feb 10, 2019

History

32 Commits
Apr 4, 2018
Apr 4, 2018
Feb 10, 2019
Dec 10, 2018
Feb 8, 2019
Apr 4, 2018
Apr 4, 2018
Dec 5, 2018
Apr 4, 2018
Feb 8, 2019
Apr 4, 2018
Feb 8, 2019
Feb 8, 2019
Dec 5, 2018
Feb 8, 2019

Repository files navigation

@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.

About

Easily remove unused Moment.js locales in Nuxt.js projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.5%
  • Vue 2.5%