scripts/node/build-icons.js
function createIconFiles(srcFile, dest) {
  const thisTaskName = swlog.logSubStart('create icon files');

  return new Promise(resolve => {
    const exportArtboardsOptions = [
      'export',
      'artboards',
      srcFile,
      `--formats=${options.iconFormats.join(',')}`,
      '--include-symbols=NO',
      '--save-for-web=YES',
      `--output=${dest}`
    ];

    const outputStr = sketchtoolExec(exportArtboardsOptions.join(' '));
    resolve(outputStr);
  })
  .then(output => {
    options.iconFormats.forEach(format => {
      const regex = new RegExp(`\\.${format}`, 'g');
      const count = (output.match(regex) || []).length;
      swlog.logTaskAction('Created', `${count} ${format.toUpperCase()} files`);
    })

    swlog.logSubEnd(thisTaskName);

    if (options.iconFormats.indexOf('svg') !== -1) {
      return optimizeSVGs(dest);
    }
  });
}
function createIconFiles(srcFile, dest) {
  const thisTaskName = swlog.logSubStart('create icon files');

  return new Promise(resolve => {
    const exportArtboardsOptions = [
      'export',
      'artboards',
      srcFile,
      `--formats=${options.iconFormats.join(',')}`,
      '--include-symbols=NO',
      '--save-for-web=YES',
      `--output=${dest}`
    ];

    const outputStr = sketchtoolExec(exportArtboardsOptions.join(' '));
    resolve(outputStr);
  })
  .then(output => {
    options.iconFormats.forEach(format => {
      const regex = new RegExp(`\\.${format}`, 'g');
      const count = (output.match(regex) || []).length;
      swlog.logTaskAction('Created', `${count} ${format.toUpperCase()} files`);
    })

    swlog.logSubEnd(thisTaskName);

    if (options.iconFormats.indexOf('svg') !== -1) {
      return optimizeSVGs(dest);
    }
  });
}
function createIconFiles ( srcFile , dest ) { const thisTaskName = swlog . logSubStart ( 'create icon files' ) ; return new Promise ( resolve => { const exportArtboardsOptions = [ 'export' , 'artboards' , srcFile , ` ${ options . iconFormats . join ( ',' ) } ` , '--include-symbols=NO' , '--save-for-web=YES' , ` ${ dest } ` ] ; const outputStr = sketchtoolExec ( exportArtboardsOptions . join ( ' ' ) ) ; resolve ( outputStr ) ; } ) . then ( output => { options . iconFormats . forEach ( format => { const regex = new RegExp ( ` \\ ${ format } ` , 'g' ) ; const count = ( output . match ( regex ) || [ ] ) . length ; swlog . logTaskAction ( 'Created' , ` ${ count } ${ format . toUpperCase ( ) } ` ) ; } ) swlog . logSubEnd ( thisTaskName ) ; if ( options . iconFormats . indexOf ( 'svg' ) !== - 1 ) { return optimizeSVGs ( dest ) ; } } ) ; }
Create the svg files form sketch layers
@see {@link https://developer.sketchapp.com/reference/api/#export}
@param {String} srcFile - The sketch file
@param {String} dest - The destination
@returns {Promise}
Create the svg files form sketch layers