It is just an attempt to make the timeago.locales.min.js file from the hustcc/timeago.js project
even smaller by refactoring current locale files.
-
Refactored files (38): bg, ca, da, de, el, en, en_short, es, eu, fa, fi, fr, gl, he, hu, in_BG, in_HI, in_ID, it, ja, ko, ml, my, nb_NO, nl, nn_NO, pl, pt_BR, ro, ru, sq, sv, ta, th, tr, vi, zh_CN, zh_TW
-
Files to refactor (4): ar, be, sr, uk
-
Minified size after refactoring: 19932 bytes (63.87% of original 31208 bytes)
-
Saved: 11276 bytes (36.13%)
- Install Node.js (tested on
6.9.x). - Download and unpack both projects
using git:
git clone https://github.com/hustcc/timeago.js.git;
git clone https://github.com/greg-dev/timeago.locales.min.js.git;
or using cUrl:
curl -LOk https://github.com/hustcc/timeago.js/archive/master.zip;
unzip master.zip;
mv timeago.js-master timeago.js;
curl -LOk https://github.com/greg-dev/timeago.locales.min.js/archive/master.zip;
unzip master.zip;
mv timeago.locales.min.js-master timeago.locales.min.js;
rm master.zip;
- Install dependencies, build original minified files:
cd timeago.js
npm install
gulp mini
webpack
cd ..
cd timeago.locales.min.js
npm install
- Copy all the source and locale files needed to build a new minified version:
cp -R ../timeago.js/src/* ./src/
cp -R ../timeago.js/dist/* ./dist/
mv ./dist/timeago.locales.min.js ./dist/timeago.locales.min-orig.js
cp -R ../timeago.js/locales/*.js ./locales_orig/
cp ../timeago.js/webpack.config.js ./
- To build a new minified locales file go to the timeago.locales.min.js directory and run the command:
npm run mini-build
- To make sure that new locales give the same output as the old ones use:
npm run mini-regression-tests
- To compare the speed of new and old locales run:
npm run mini-performance-tests