keeweb/app/scripts/hbs-helpers/svg.js

10 lines
251 B
JavaScript
Raw Normal View History

2020-03-29 15:01:11 +02:00
import Handlebars from 'hbs';
Handlebars.registerHelper('svg', (name, cls) => {
const icon = require(`svg/${name}.svg`).default;
2020-04-15 16:50:01 +02:00
if (typeof cls === 'string') {
2020-03-29 15:01:11 +02:00
return `<svg class="${cls}"` + icon.substr(4);
}
return icon;
});