Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Explicitly require locales to include them in Browserify build #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ var moment = require('moment')
, half = 1000 * 30
, o = document.querySelectorAll.bind(document);

/*
* I have to require explicitly all locales I want to use
* because Browserify only put in its bundle the required modules.
* More here: https://github.com/moment/moment/issues/2007
*/

require('moment/locale/ca');
require('moment/locale/de');
require('moment/locale/el');
require('moment/locale/es');
require('moment/locale/fi');
require('moment/locale/fr');
require('moment/locale/gl');
require('moment/locale/hu');
require('moment/locale/it');
require('moment/locale/nl');
require('moment/locale/pl');
require('moment/locale/pt');
require('moment/locale/ru');
require('moment/locale/sq');
require('moment/locale/sv');
require('moment/locale/uk');
require('moment/locale/zh-tw');

module.exports = Timeago;

/**
Expand Down Expand Up @@ -83,4 +107,4 @@ function toArray (list) {

function updateElement (el) {
el.innerHTML = moment(el.getAttribute(this.attr)).fromNow();
}
}