forked from 2sic/2sxc-eav-languages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
110 lines (97 loc) · 3.21 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
module.exports = function (grunt) {
"use strict";
var srcRoot = "src/i18n/",
distRoot = "dist/",
tmpRoot = "tmp/",
tmpAnalytics = "tmp/analyt/",
analysisRoot = "analysis/";
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
clean: {
dist: distRoot + "**/*", // only do this when you will re-copy the eav stuff into here
tmp: tmpRoot + "**/*"
},
/* This is an experimental block - will merge the few changes in -en-uk with the master -en */
/* 2015-11-29 dm - seems to work, but not very generic yet. Will persue more when I have a real use case */
//"merge-json": {
// "en-uk": {
// src: [ srcRoot + "admin-en.json", srcRoot + "admin-en-uk.json" ],
// dest: tmpRoot + "admin-en-uk.js"
// }
//},
copy: {
enUk: {
files: [
]
},
i18n: {
files: [
{
expand: true,
cwd: "src/i18n/",
src: ["**/*.json"],
dest: "dist/i18n/",
rename: function (dest, src) {
return dest + src.replace(".json", ".js");
}
}
]
}
},
/* Experiment to flatten the JSON for reviewing translation completeness */
//flatten_json: {
// main: {
// files: [
// {
// expand: true,
// src: [srcRoot + "*-en.json"],
// dest: analysisRoot
// }
// ]
// }
//},
/* Experimeting with wrapping the flattened jsons with [ and ] */
/* note: doesn't work ATM*/
//concat: {
// options: {
// banner: "[",
// footer: "]"
// },
// default: {
// src: [analysisRoot + "**/*.json"],
// dest: tmpAnalytics
// //,
// //dest:
// }
// //default_options: {
// // files: [
// // {
// // prepend: "[",
// // append: "]",
// // input: analysisRoot + "**/*.json" //,
// // //output: 'path/to/output/file'
// // }
// // ]
// //}
//},
/* Watchers to auto-compile while working on it */
watch: {
i18n: {
files: ["gruntfile.js", "src/**"],
tasks: ["build"]
}
}
});
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-merge-json");
// grunt.loadNpmTasks("grunt-flatten-json");
// grunt.loadNpmTasks("grunt-contrib-concat");
// Default task(s).
grunt.registerTask("build-auto", ["watch:i18n"]);
grunt.registerTask("build", [
"clean:tmp",
"copy"
]);
};