-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGruntfile.js
105 lines (88 loc) · 2.5 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
'use strict';
module.exports = function(grunt) {
var pages = require('./lib/i18n');
var read = function(src) {
return grunt.file.readJSON(src);
};
grunt.util._.mixin({
read: read,
expand: function(src) {
return grunt.file.expand(src).map(read);
}
});
// Project configuration.
grunt.initConfig({
i18n_alt: grunt.file.readJSON('test/fixtures/data/i18n-alt.json'),
assemble: {
options: {
plugins: ['./index.js'],
data: 'test/fixtures/data/**/*.json',
flatten: true,
partials: 'test/fixtures/templates/includes/*.hbs',
layoutdir: 'test/fixtures/templates/layouts',
layout: 'default.hbs'
},
"without-plugin": {
options: {
language: 'fr',
pages: '<%= i18n_alt.languages %>'
},
files: {'test/actual/without-plugin/': ['test/fixtures/templates/without-plugin/*.hbs']},
},
"with-plugin": {
options: {
i18n: {
data: ['test/fixtures/data/i18n.json', 'test/fixtures/data/i18n/*.json'],
templates: ['test/fixtures/templates/with-plugin/*.hbs']
}
},
dest: 'test/actual/with-plugin/',
src: '!*.*'
},
"with-permalinks": {
options: {
plugins: ['index.js', 'grunt-assemble-permalinks'],
i18n: {
data: 'test/fixtures/data/i18n.json',
templates: ['test/fixtures/templates/*.hbs']
},
permalinks: {
structure: ':language/index.html'
}
},
dest: 'test/actual/with-permalinks/',
src: '!*.*'
},
"with-list-of-languages": {
options: {
i18n: {
languages: ["en", "fr", "es"],
templates: ['test/fixtures/templates/*.hbs']
}
},
dest: 'test/actual/with-list-of-languages/',
src: '!*.*'
}
},
/**
* Run mocha tests.
*/
mochaTest: {
tests: {
options: {
reporter: 'spec'
},
src: ['test/**/*-test.js']
}
},
// Before creating new files, remove files from previous build.
clean: ['test/actual/**/*.html']
});
// Load npm plugins to provide necessary tasks.
grunt.loadNpmTasks('grunt-assemble');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('test', ['mochaTest']);
// Default task to be run.
grunt.registerTask('default', ['clean', 'assemble', 'test']);
};