lib/src/main.js
function getAssets(reportOptions) {
  const { assetsDir, cdn, dev, inlineAssets, reportDir } = reportOptions;
  const relativeAssetsDir = path.relative(reportDir, assetsDir);

  // Default URLs to assets path
  const assets = {
    inlineScripts: null,
    inlineStyles: null,
    scriptsUrl: path.join(relativeAssetsDir, 'app.js'),
    stylesUrl: path.join(relativeAssetsDir, 'app.css')
  };

  // If using inline assets, load files and strings
  if (inlineAssets) {
    assets.inlineScripts = loadFile(path.join(distDir, 'app.js'));
    assets.inlineStyles = loadFile(path.join(distDir, 'app.inline.css'));
  }

  // If using CDN, return remote urls
  if (cdn) {
    assets.scriptsUrl = `https://unpkg.com/mochawesome-report-generator@${pkg.version}/dist/app.js`;
    assets.stylesUrl = `https://unpkg.com/mochawesome-report-generator@${pkg.version}/dist/app.css`;
  }

  // In DEV mode, return local urls
  if (dev) {
    assets.scriptsUrl = 'http://localhost:8080/app.js';
    assets.stylesUrl = 'http://localhost:8080/app.css';
  }

  // Copy the assets if needed
  if (!dev && !cdn && !inlineAssets) {
    copyAssets(reportOptions);
  }

  return assets;
}
function getAssets(reportOptions) {
  const { assetsDir, cdn, dev, inlineAssets, reportDir } = reportOptions;
  const relativeAssetsDir = path.relative(reportDir, assetsDir);

  // Default URLs to assets path
  const assets = {
    inlineScripts: null,
    inlineStyles: null,
    scriptsUrl: path.join(relativeAssetsDir, 'app.js'),
    stylesUrl: path.join(relativeAssetsDir, 'app.css')
  };

  // If using inline assets, load files and strings
  if (inlineAssets) {
    assets.inlineScripts = loadFile(path.join(distDir, 'app.js'));
    assets.inlineStyles = loadFile(path.join(distDir, 'app.inline.css'));
  }

  // If using CDN, return remote urls
  if (cdn) {
    assets.scriptsUrl = `https://unpkg.com/mochawesome-report-generator@${pkg.version}/dist/app.js`;
    assets.stylesUrl = `https://unpkg.com/mochawesome-report-generator@${pkg.version}/dist/app.css`;
  }

  // In DEV mode, return local urls
  if (dev) {
    assets.scriptsUrl = 'http://localhost:8080/app.js';
    assets.stylesUrl = 'http://localhost:8080/app.css';
  }

  // Copy the assets if needed
  if (!dev && !cdn && !inlineAssets) {
    copyAssets(reportOptions);
  }

  return assets;
}
function getAssets ( reportOptions ) { const { assetsDir , cdn , dev , inlineAssets , reportDir } = reportOptions ; const relativeAssetsDir = path . relative ( reportDir , assetsDir ) ; // Default URLs to assets path const assets = { inlineScripts : null , inlineStyles : null , scriptsUrl : path . join ( relativeAssetsDir , 'app.js' ) , stylesUrl : path . join ( relativeAssetsDir , 'app.css' ) } ; // If using inline assets, load files and strings if ( inlineAssets ) { assets . inlineScripts = loadFile ( path . join ( distDir , 'app.js' ) ) ; assets . inlineStyles = loadFile ( path . join ( distDir , 'app.inline.css' ) ) ; } // If using CDN, return remote urls if ( cdn ) { assets . scriptsUrl = ` ${ pkg . version } ` ; assets . stylesUrl = ` ${ pkg . version } ` ; } // In DEV mode, return local urls if ( dev ) { assets . scriptsUrl = 'http://localhost:8080/app.js' ; assets . stylesUrl = 'http://localhost:8080/app.css' ; } // Copy the assets if needed if ( ! dev && ! cdn && ! inlineAssets ) { copyAssets ( reportOptions ) ; } return assets ; }
Get the report assets object

@param {Object} reportOptions Options
@return {Object} Object with assets props
Get the report assets object