This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Gruntfile.js
73 lines (67 loc) · 1.93 KB
/
Gruntfile.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
62
63
64
65
66
67
68
69
70
71
72
73
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
base: ['app', '.'],
livereload: true
}
}
},
watch: {
options: {
livereload: true
},
scripts: {
files: ['app/**/*.js', 'lib/**/*.js'],
tasks: ['jshint']
},
html: {
files: ['app/**/*.html']
},
translations: {
files: ['translations/**/*.json'],
tasks: ['jsonlint', 'concat']
}
},
jshint: {
uses_defaults: ['app/**/*.js', 'lib/**/*.js']
},
jsonlint: {
uses_defaults: ['translations/**/*.json']
},
release: {
options: {
additionalFiles: ['bower.json']
}
},
concat: {
translations: {
options: {
banner: '/* Generated file, do not edit. */\n' +
'Ember.ENV.I18N_SUPPORTED_LANGUAGES = [];\n' +
'Ember.ENV.translations={};\n',
process: function (src, filepath) {
var language = filepath.split('/').pop().split('.')[0];
var supported = 'Ember.ENV.I18N_SUPPORTED_LANGUAGES.push(\'' + language + '\')';
var key = 'Ember.ENV.translations.' + language;
var value = JSON.stringify(JSON.parse(src));
return supported + ';\n' + key + '=' + value + ';';
}
},
src: ['translations/**/*.json'],
dest: 'lib/translations.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-release');
grunt.registerTask('compile', ['jsonlint', 'concat']);
grunt.registerTask('serve', ['jshint', 'compile', 'connect', 'watch']);
grunt.registerTask('default', ['serve']);
};