quickbuild
Version:
A mature, feature-complete application generator with an emphasis on speed
13 lines (11 loc) • 438 B
JavaScript
const links = document.querySelectorAll('link[rel="import"]')
// Import and add each page to the DOM
Array.prototype.forEach.call(links, (link) => {
let template = link.import.querySelector('.task-template')
let clone = document.importNode(template.content, true)
if (link.href.match('about.html')) {
document.querySelector('body').appendChild(clone)
} else {
document.querySelector('.content').appendChild(clone)
}
})