Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var sitePath = options.sitePath;
grunt.log.writeln('Prerendering ...');
var snapshotOptions = {
phantomScript: options.phantomScript,
timeout: options.timeout,
selector: options.selector,
interval: options.interval
};
if (options.sitemap) {
var urlObj = require('url').parse(options.sitemap);
sitePath = urlObj.protocol + '//' + urlObj.host;
require('sitemapper').getSites(options.sitemap, function(err, urls) {
if (err) {
var urls = options.urls;
}
urls = urls.map(function(url) {
return require('url').parse(url).pathname;
});
crawlUrls(urls);
});
} else {
// strip site path of trailing slash
if (sitePath[sitePath.length-1] === '/') sitePath = sitePath.slice(0, -1);
var urls = options.urls;
crawlUrls(urls);
}