Skip to content

Instantly share code, notes, and snippets.

@wangzuo
Created November 3, 2014 04:27
Show Gist options
  • Save wangzuo/47733c1622935a92a624 to your computer and use it in GitHub Desktop.
Save wangzuo/47733c1622935a92a624 to your computer and use it in GitHub Desktop.
gulp locales
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var declare = require('gulp-declare');
var rename = require('gulp-rename');
var locales = ['nb_NO', 'nn_NO'];
locales.forEach(function(locale) {
gulp.task(locale, function() {
return gulp.src('builds/locales/'+locale+'.json')
.pipe(declare({
namespace: 'RE.locales',
noRedeclare: true
}))
.pipe(rename(locale+'.js'))
.pipe(gulp.dest('builds/locales'));
});
gulp.task('moment-'+locale, [locale], function() {
return gulp.src(['js/libs/moment.js', 'builds/locales/'+locale+'.js',
'langs/moment.'+locale+'.js'])
.pipe(concat(locale+'.js'))
.pipe(uglify())
.pipe(gulp.dest('builds/locales'));
});
});
gulp.task('locales', locales.map(function(locale) {
return 'moment-' + locale;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment