async function generate(params, cb) {
  try {
    const options = await getOptions(params);
    const {target = {}, base = process.cwd()} = options;
    const result = await create(options);
    // Store generated css
    if (target.css) {
      await outputFileAsync(path.resolve(base, target.css), result.css);
    }

    // Store generated html
    if (target.html) {
      await outputFileAsync(path.resolve(base, target.html), result.html);
    }

    // Store extracted css
    if (target.uncritical) {
      await outputFileAsync(path.resolve(base, target.uncritical), result.uncritical);
    }

    if (typeof cb === 'function') {
      cb(null, result);
      return;
    }

    return result;
  } catch (error) {
    if (typeof cb === 'function') {
      cb(error);
      return;
    }

    throw error;
  }
}
Critical path CSS generation
@param  {object} params Options
@param  {function} cb Callback
@return {Promise<object>} Result object with html, css & optional extracted original css