Fixing icons not obeying the size attribute

This commit is contained in:
Jocelyn Badgley (Twipped) 2021-03-25 14:04:59 -07:00
parent 7eb3bfe69a
commit b919a7cf11

View File

@ -251,11 +251,13 @@ class Injectables {
const { hash, env, resolve: rval } = args.pop();
const local = rval('@root.this.local');
const tpath = path.join(local.root, 'svg', name + '.svg');
if (hash.size && String(hash.size).match(/^\d+$/)) {
hash.size = hash.size + 'px';
}
const frame = handybars.makeContext(hash, env);
try {
const contents = self._template(tpath, (s) =>
handybars(`<span class="svg-icon" {{#if size}}style="width:{{size}}px;height:{{size}}px"{{/if}}>${s}</span>`),
handybars(`<span class="svg-icon" style="{{#if this.size}}width:{{this.size}};height:{{this.size}};{{/if}}{{this.style}}">${s}</span>`),
)(frame);
return handybars.safe(contents);