2016-07-21 14:35:23 +02:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
dump_dir: (function() {
|
|
|
|
var out = {};
|
2016-07-26 22:04:25 +02:00
|
|
|
|
2016-07-21 14:35:23 +02:00
|
|
|
grunt.file.expand({ filter: 'isDirectory'}, 'public/fonts/invoice-fonts/*').forEach(function(path) {
|
|
|
|
var fontName = /[^/]*$/.exec(path)[0],
|
|
|
|
files = {},
|
|
|
|
license='';
|
2016-07-26 22:04:25 +02:00
|
|
|
|
2016-07-21 14:35:23 +02:00
|
|
|
// Add license text
|
|
|
|
grunt.file.expand({ filter: 'isFile'}, path+'/*.txt').forEach(function(path) {
|
|
|
|
var licenseText = grunt.file.read(path);
|
|
|
|
|
|
|
|
// Fix anything that could escape from the comment
|
|
|
|
licenseText = licenseText.replace(/\*\//g,'*\\/');
|
|
|
|
|
|
|
|
license += "/*\n"+licenseText+"\n*/";
|
|
|
|
});
|
2016-07-26 22:04:25 +02:00
|
|
|
|
2016-07-21 14:35:23 +02:00
|
|
|
// Create files list
|
|
|
|
files['public/js/vfs_fonts/'+fontName+'.js'] = [path+'/*.ttf'];
|
2016-07-26 22:04:25 +02:00
|
|
|
|
2016-07-21 14:35:23 +02:00
|
|
|
out[fontName] = {
|
|
|
|
options: {
|
|
|
|
pre: license+'window.ninjaFontVfs=window.ninjaFontVfs||{};window.ninjaFontVfs.'+fontName+'=',
|
|
|
|
rootPath: path+'/'
|
|
|
|
},
|
|
|
|
files: files
|
|
|
|
};
|
2016-07-26 22:04:25 +02:00
|
|
|
});
|
|
|
|
|
2016-07-21 14:35:23 +02:00
|
|
|
// Return the computed object
|
|
|
|
return out;
|
2017-11-07 19:56:00 +01:00
|
|
|
}())
|
2016-07-21 14:35:23 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-dump-dir');
|
2017-11-07 19:56:00 +01:00
|
|
|
grunt.registerTask('default', ['dump_dir']);
|
2016-07-21 14:35:23 +02:00
|
|
|
|
|
|
|
};
|