Skip to content

Instantly share code, notes, and snippets.

@srsad
Last active August 5, 2019 11:11
Show Gist options
  • Save srsad/ace90c282fb3dbea3e79c28cd966e29a to your computer and use it in GitHub Desktop.
Save srsad/ace90c282fb3dbea3e79c28cd966e29a to your computer and use it in GitHub Desktop.
// заказчик начал просто закидывать скриптами от разных сервисов,
// писать для каждого отельный модуль, слишком затратно по времени, по этому вот такой костыль
// в итоге подключаем все скрипты после </body> и отдаем нормальный html
hooks: {
generate: {
page(page) {
let jsFiles = [
`jivosite script`,
`aloka`,
`calltraking`,
`Yandex.Metrika counter`,
// ...
];
for (const item of jsFiles) {
page.html = page.html.replace('</body>', `${item}</body>`)
}
return page
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment