]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fix #1071 - allows embedding only one language
authorBrian Wyant <wyantb@gmail.com>
Sat, 14 Sep 2013 01:21:33 +0000 (21:21 -0400)
committerBrian Wyant <wyantb@gmail.com>
Sat, 14 Sep 2013 01:21:33 +0000 (21:21 -0400)
Gruntfile.js

index 4bad9bd9e0f89a13b1bad53414a5d645ee2f123a..3dc8b99e41ca81ae0d2e2d01fe2326da3544bc93 100644 (file)
@@ -1,4 +1,18 @@
 module.exports = function (grunt) {
+
+    var embedOption = grunt.option('embed_languages'),
+        embedLanguageDest = embedOption ?
+            'min/moment+customlangs.js' :
+            'min/moment+langs.js',
+        embedLanguageLangs = 'lang/*.js';
+
+    if (embedOption && embedOption.match(/,/)) {
+        embedLanguageLangs = 'lang/{' + embedOption + '}.js';
+    }
+    else if (embedOption) {
+        embedLanguageLangs = 'lang/' + embedOption + '.js';
+    }
+
     grunt.initConfig({
         pkg: grunt.file.readJSON('package.json'),
         concat : {
@@ -78,12 +92,8 @@ module.exports = function (grunt) {
         },
         embed_languages: {
             moment: 'moment.js',
-            dest: grunt.option('embed_languages') ?
-                'min/moment+customlangs.js' :
-                'min/moment+langs.js',
-            targetLangs: grunt.option('embed_languages') ?
-                'lang/{' + grunt.option('embed_languages') + '}.js':
-                'lang/*.js'
+            dest: embedLanguageDest,
+            targetLangs: embedLanguageLangs
         }
     });