0

Ember > 2.0 + Ember suave are telling me:

"requireTemplateStringsForConcatenation: Using manual concatenation with strings is not allowed at helpers/svg-icon.js"

import Ember from 'ember';

export function svgIcon(iconName) {
  return Ember.String.htmlSafe("<svg class='icon-x'><use xlink:href='#icon-" +  iconName + "'></use></svg>");
}

export default Ember.Helper.helper(svgIcon);

I've just come from a meetup where Ember.string.fmt was discussed and sounded promising ~ but that has been deprecated and suggests you use ES2015 Template Strings.

Reading about those here: http://babeljs.io/docs/learn-es2015/

I am unclear about how 'manual' concatenation works - what the problem would be - and well, the whole thing.

return Ember.String.htmlSafe("<svg class='icon-x'><use xlink:href='#icon-${iconName}'></use></svg>"); ?

Implementation and reasoning happily accepted.

sheriffderek
  • 8,848
  • 6
  • 43
  • 70

0 Answers0