utils/assets-utils.js
function getFilePathWithHash(filePath, rel) {
  const indexOfLastDot = filePath.lastIndexOf('.');

  let filePathWithHash = filePath.substr(0, indexOfLastDot) +
    '.' +
    hashFile.sync(skyPagesConfigUtil.spaPath('src', filePath)) +
    '.' +
    filePath.substr(indexOfLastDot + 1);

  if (!rel) {
    const srcPath = skyPagesConfigUtil.spaPath('src');
    filePathWithHash = filePathWithHash.substr(srcPath.length + 1);
  }

  return filePathWithHash;
}
function getFilePathWithHash(filePath, rel) {
  const indexOfLastDot = filePath.lastIndexOf('.');

  let filePathWithHash = filePath.substr(0, indexOfLastDot) +
    '.' +
    hashFile.sync(skyPagesConfigUtil.spaPath('src', filePath)) +
    '.' +
    filePath.substr(indexOfLastDot + 1);

  if (!rel) {
    const srcPath = skyPagesConfigUtil.spaPath('src');
    filePathWithHash = filePathWithHash.substr(srcPath.length + 1);
  }

  return filePathWithHash;
}
function getFilePathWithHash ( filePath , rel ) { const indexOfLastDot = filePath . lastIndexOf ( '.' ) ; let filePathWithHash = filePath . substr ( 0 , indexOfLastDot ) + '.' + hashFile . sync ( skyPagesConfigUtil . spaPath ( 'src' , filePath ) ) + '.' + filePath . substr ( indexOfLastDot + 1 ) ; if ( ! rel ) { const srcPath = skyPagesConfigUtil . spaPath ( 'src' ) ; filePathWithHash = filePathWithHash . substr ( srcPath . length + 1 ) ; } return filePathWithHash ; }
Appends the hash of the specified file to the end of the file path.
@param {*} filePath The path to the file.
@param {*} rel Optional Boolean flag indicating whether the returned path should be relative
to the app's src path.
Appends the hash of the specified file to the end of the file path .