UNPKG

generate-examples-index-webpack-plugin

Version:
21 lines (16 loc) 556 B
const path = require('path'); /** * Generate the HTML for the breadcrumbs associated to an example page */ function getBreadCrumbsHtml(chunk) { let html = `<li class="breadcrumb-item"> <a href="../index.html">Examples</a> </li>`; const steps = chunk.split(path.sep); for (let i = 0; i < steps.length; i++) { const activeClass = i === steps.length - 1 ? ' active' : ''; html += `<li class="breadcrumb-item${activeClass}">${steps[i]}</li>`; } return `<ol class="breadcrumb">${html}</ol>`; } module.exports = getBreadCrumbsHtml;