tasks/views.js
function build(config, locale, done) {
  const shouldWatch = (util.env[`watch`] || util.env[`w`]) && (config.watch !== false);

  if (locale && config.i18n && (config.i18n.locales instanceof Array) && (locale === config.i18n.locales[0]))
    locale = undefined;

  config = normalizeConfig(config, locale);

  metalsmith(config.base || __dirname)
    .clean(false)
    .source(config.src)
    .ignore(config.ignore)
    .destination(config.dest)
    .metadata(config.metadata.global)
    .use(collections(config.collections))
    .use(related(config.related))
    .use((config.tags) ? tags(config.tags) : noop())
    .use(pagination(config.pagination))
    .use(metadata(config.metadata.collections))
    .use(markdown(config.markdown))
    .use(config.multilingual ? multilingual(locale) : noop())
    .use(permalinks(config.permalinks))
    .use(pathfinder(locale, config.i18n && config.i18n.locales))
    .use(layouts(config.layouts))
    .use(inPlace(config.inPlace))
    .use((config.prism !== false) ? prism(config.prism, locale) : noop())
    .use((config.mathjax !== false) ? mathjax(config.mathjax, locale) : noop())
    .use(permalinks(config.permalinks))
    .use(reporter(locale))
    .build(function(err) {
      if (err && shouldWatch) util.log(util.colors.blue(`[metalsmith]`), util.colors.red(err));
      done(!shouldWatch && err);
    });
}
function build(config, locale, done) {
  const shouldWatch = (util.env[`watch`] || util.env[`w`]) && (config.watch !== false);

  if (locale && config.i18n && (config.i18n.locales instanceof Array) && (locale === config.i18n.locales[0]))
    locale = undefined;

  config = normalizeConfig(config, locale);

  metalsmith(config.base || __dirname)
    .clean(false)
    .source(config.src)
    .ignore(config.ignore)
    .destination(config.dest)
    .metadata(config.metadata.global)
    .use(collections(config.collections))
    .use(related(config.related))
    .use((config.tags) ? tags(config.tags) : noop())
    .use(pagination(config.pagination))
    .use(metadata(config.metadata.collections))
    .use(markdown(config.markdown))
    .use(config.multilingual ? multilingual(locale) : noop())
    .use(permalinks(config.permalinks))
    .use(pathfinder(locale, config.i18n && config.i18n.locales))
    .use(layouts(config.layouts))
    .use(inPlace(config.inPlace))
    .use((config.prism !== false) ? prism(config.prism, locale) : noop())
    .use((config.mathjax !== false) ? mathjax(config.mathjax, locale) : noop())
    .use(permalinks(config.permalinks))
    .use(reporter(locale))
    .build(function(err) {
      if (err && shouldWatch) util.log(util.colors.blue(`[metalsmith]`), util.colors.red(err));
      done(!shouldWatch && err);
    });
}
function build ( config , locale , done ) { const shouldWatch = ( util . env [ ` ` ] || util . env [ ` ` ] ) && ( config . watch !== false ) ; if ( locale && config . i18n && ( config . i18n . locales instanceof Array ) && ( locale === config . i18n . locales [ 0 ] ) ) locale = undefined ; config = normalizeConfig ( config , locale ) ; metalsmith ( config . base || __dirname ) . clean ( false ) . source ( config . src ) . ignore ( config . ignore ) . destination ( config . dest ) . metadata ( config . metadata . global ) . use ( collections ( config . collections ) ) . use ( related ( config . related ) ) . use ( ( config . tags ) ? tags ( config . tags ) : noop ( ) ) . use ( pagination ( config . pagination ) ) . use ( metadata ( config . metadata . collections ) ) . use ( markdown ( config . markdown ) ) . use ( config . multilingual ? multilingual ( locale ) : noop ( ) ) . use ( permalinks ( config . permalinks ) ) . use ( pathfinder ( locale , config . i18n && config . i18n . locales ) ) . use ( layouts ( config . layouts ) ) . use ( inPlace ( config . inPlace ) ) . use ( ( config . prism !== false ) ? prism ( config . prism , locale ) : noop ( ) ) . use ( ( config . mathjax !== false ) ? mathjax ( config . mathjax , locale ) : noop ( ) ) . use ( permalinks ( config . permalinks ) ) . use ( reporter ( locale ) ) . build ( function ( err ) { if ( err && shouldWatch ) util . log ( util . colors . blue ( ` ` ) , util . colors . red ( err ) ) ; done ( ! shouldWatch && err ) ; } ) ; }
Runs Metalsmith build on specified locale.

@param {Object} config
@param {string} locale
@param {Function} done
Runs Metalsmith build on specified locale .