code: function generatePrismicDocuments(config) {
    return prismic.getAPI(config.apiEndpoint, { accessToken: config.accessToken })
      .then(api => (prismic.getEverything(api, null, ``, _.flatMap(config.collections, (val, key) => (`my.${key}.${val.sortBy}${val.reverse ? ` desc` : ``}`)))))
      .then(res => {
        util.log(util.colors.blue(`[prismic]`), `Fetched a total of ${res.results.length} documents`);
        if (res.results.length) res.results.forEach(doc => util.log(util.colors.blue(`[prismic]`), `Fetched document [${doc.type}]: ${doc.slug}`));
        const documents = prismic.reduce(res.results, false, config);
  
        // Populate config metadata with retrieved documents.
        if (!config.metadata) config.metadata = { $data: {} };
        _.merge(config.metadata.$data, documents);
  
        for (let docType in documents) {
          const c = _.get(config, `collections.${docType}`);
  
          if (c && c.permalink) {
            const subdir = `.prismic/${docType}`;
            const dir = path.join(path.join(config.base || ``, config.src || ``), subdir);
            c.pattern = path.join(subdir, `**/*`);
  
            documents[docType].forEach(doc => {
              const filename = `${doc.uid || _.kebabCase(doc.slug)}.html`;
              const frontMatter = yaml.stringify(_.omit(doc, [`next`, `prev`]));
              fs.mkdirsSync(dir);
              fs.writeFileSync(path.join(dir, filename), `---\n${frontMatter}---\n`);
            });
          }
        }
  
        return;
      });
  }
docs: Generates HTML files with YAML front matters from Prismic documents.
  
  @param {Object} config - Config object.
  
  @return {Promise} - Promise with no fulfillment value.