UNPKG

gaf-mobile

Version:

GAF mobile Web site

28 lines (23 loc) 899 B
'use strict'; var distDir = 'www'; module.exports = function(grunt) { // Generates the prerender.json file needed by fl-prerender grunt.registerTask('prerenderConfig', 'Generate prerender.json', function() { var path = require('path'); var scriptDir = path.resolve(distDir, 'scripts'); var configFile = path.resolve(distDir, 'prerender.json'); var scripts = []; grunt.file.recurse(scriptDir, function(abspath, rootDir, subdir, filename) { var _subdir = subdir ? subdir : ''; // Avoid sourcemap file as it breaks the pre-render engine if(path.extname(filename) !== '.map') { scripts.push('scripts' + path.sep + _subdir + filename); } }); grunt.file.write(configFile, JSON.stringify({ scripts: scripts }, null, '\t')); grunt.log.ok('Prerender config written to ' + path.relative(__dirname, configFile)); }); };