forked from OpenSlides/openslides-votecollector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (51 loc) · 1.81 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* Gulp tasks for openslides votecollector plugin.
*
* Run
*
* $ ./node_modules/.bin/gulp
*
*/
// TODO: Remove the next line when support for Node 0.10.x is dropped.
// See https://github.com/postcss/postcss#nodejs-010-and-the-promise-api
require('es6-promise').polyfill();
var gulp = require('gulp'),
gettext = require('gulp-angular-gettext'),
jshint = require('gulp-jshint'),
path = require('path')
/**
* Default tasks to be run before start.
*/
// Compiles translation files (*.po) to *.json and saves them in the directory 'i18n'.
gulp.task('translations', function () {
return gulp.src(path.join('openslides_votecollector', 'locale', 'angular-gettext', '*.po'))
.pipe(gettext.compile({
format: 'json'
}))
.pipe(gulp.dest(path.join('openslides_votecollector', 'static', 'i18n', 'openslides_votecollector')));
});
// Gulp default task. Runs all other tasks before.
gulp.task('default', ['translations'], function () {});
/**
* Extra tasks that have to be called manually. Useful for development.
*/
// Extracts translatable strings using angular-gettext and saves them in file
// locale/angular-gettext/template-en.pot.
gulp.task('pot', function () {
return gulp.src([
'openslides_votecollector/static/templates/*/*.html',
'openslides_votecollector/static/js/*/*.js',
])
.pipe(gettext.extract('template-en.pot', {}))
.pipe(gulp.dest(path.join('openslides_votecollector', 'locale', 'angular-gettext')));
});
// Checks JavaScript using JSHint
gulp.task('jshint', function () {
return gulp.src([
'gulpfile.js',
path.join( 'openslides_votecollector', 'static', '*', '*.js' ),
])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});