From 70c119936171c76fba71c7c21bdf05915569cfe3 Mon Sep 17 00:00:00 2001 From: Martin Wollny Date: Fri, 8 Nov 2019 15:24:40 +0100 Subject: [PATCH] Update to read config data packe first --- tasks/html_sitemap.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tasks/html_sitemap.js b/tasks/html_sitemap.js index f24a69e..ef7c0a2 100644 --- a/tasks/html_sitemap.js +++ b/tasks/html_sitemap.js @@ -17,9 +17,12 @@ module.exports = function(grunt) { // Register our task grunt.registerMultiTask('html_sitemap', 'Create HTML sitemaps from a directory.', function() { + // Read package.json + const pkg = grunt.config.data.pkg || grunt.file.readJSON('package.json') + // Merge task-specific and/or target-specific options with these defaults. var taskOpts = this.options({ - siteBase: JSON.parse(grunt.file.read('package.json')).homepage, + siteBase: pkg.homepage, separator: false, searchPath: '', template: false, @@ -98,7 +101,7 @@ module.exports = function(grunt) { } }); - + // Get unique destinations and write to them var destinations = _.uniq(outFiles, function(file) { if (taskOpts.template) {