lib/core/generator.js
async function copyMandatoryFiles () {
  const buildDir = createAndGetBuildFolder()

  for (const f of assetsToCopy) {
    const filepath = path.resolve(f)

    // Get filename and dirname from the provided path.
    const filename = path.basename(filepath)
    const dirname = path.basename(path.dirname(filepath))

    // Create the directory for this file if needed.
    // ie. css/master.css needs a `css` directory.
    const targetDir = path.join(buildDir, dirname)
    sfs.createDir(targetDir)

    // And copy the file.
    const targetPath = path.join(targetDir, filename)

    console.log('- ' + targetPath)
    try {
      await writeFilePromised(targetPath, await readFilePromised(filepath))
    } catch (e) {
      const msg = chalk.dim(`(${e.message})`)
      console.error(`There was an error while copying ${chalk.bold(filename)}. ${msg}`)
    }
  }
}
async function copyMandatoryFiles () {
  const buildDir = createAndGetBuildFolder()

  for (const f of assetsToCopy) {
    const filepath = path.resolve(f)

    // Get filename and dirname from the provided path.
    const filename = path.basename(filepath)
    const dirname = path.basename(path.dirname(filepath))

    // Create the directory for this file if needed.
    // ie. css/master.css needs a `css` directory.
    const targetDir = path.join(buildDir, dirname)
    sfs.createDir(targetDir)

    // And copy the file.
    const targetPath = path.join(targetDir, filename)

    console.log('- ' + targetPath)
    try {
      await writeFilePromised(targetPath, await readFilePromised(filepath))
    } catch (e) {
      const msg = chalk.dim(`(${e.message})`)
      console.error(`There was an error while copying ${chalk.bold(filename)}. ${msg}`)
    }
  }
}
async function copyMandatoryFiles ( ) { const buildDir = createAndGetBuildFolder ( ) for ( const f of assetsToCopy ) { const filepath = path . resolve ( f ) // Get filename and dirname from the provided path. const filename = path . basename ( filepath ) const dirname = path . basename ( path . dirname ( filepath ) ) // Create the directory for this file if needed. // ie. css/master.css needs a `css` directory. const targetDir = path . join ( buildDir , dirname ) sfs . createDir ( targetDir ) // And copy the file. const targetPath = path . join ( targetDir , filename ) console . log ( '- ' + targetPath ) try { await writeFilePromised ( targetPath , await readFilePromised ( filepath ) ) } catch ( e ) { const msg = chalk . dim ( ` ${ e . message } ` ) console . error ( ` ${ chalk . bold ( filename ) } ${ msg } ` ) } } }
Add css and any mandatory files specified to the build directory
Add css and any mandatory files specified to the build directory