-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathhandlebars.js
40 lines (38 loc) · 1.2 KB
/
handlebars.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
const path = require('path');
module.exports = function(grunt) {
return {
compile: {
options: {
amd: 'handlebars',
namespace: 'Handlebars.templates',
processName: function(filePath) {
let newFilePath = filePath.split('/');
newFilePath = newFilePath[newFilePath.length - 1].replace(/\.[^/.]+$/, '');
return newFilePath;
},
partialRegex: /.*/,
partialsPathRegex: /\/partials\//
},
files: [
{
src: [
'<%= sourcedir %>core/templates/**/*.hbs',
'<%= sourcedir %>components/*/templates/**/*.hbs',
'<%= sourcedir %>extensions/*/templates/**/*.hbs',
'<%= sourcedir %>menu/<%= menu %>/**/*.hbs',
'<%= sourcedir %>theme/<%= theme %>/**/*.hbs'
],
follow: true,
dest: '<%= outputdir %>templates.js',
filter: function(filepath) {
if (filepath.indexOf(path.join(grunt.config('sourcedir'), 'core')) > -1) {
// Always include core templates.
return true;
}
return grunt.config('helpers').includedFilter(filepath);
}
}
]
}
};
};