0

When I'm adding a string to the grunt-include-replace includes like shown below, I get an 'unexpected token error' in the console and the html file doesn't compile.

@@include('components/navigation.html', {
  "list-elements": "<li><a href="#">home</a></li>"
})

I think there are problems with the special characters <>/#".

How can I make those characters work in the string?

herrh
  • 1,328
  • 1
  • 16
  • 33
  • Try with this: `'
  • home
  • '` Btw, usually the unexpected token error in Chrome says afterwards the character that breaks the thread. Something like this: `Unexpected token .` If you get that, please post it. – Lucio Oct 10 '15 at 01:37
  • The terminal console gives the following output: `running "includereplace:all" (includereplace) task >> Processing app/src/index.html Warning: Unexpected token ' Use --force to continue.` – herrh Oct 10 '15 at 13:13
  • This is a JSON error. I solved the problem with escaping the quotes by adding backslashes. @@include('components/navigation.html', { "list-elements": "
  • home
  • " }) – herrh Oct 11 '15 at 14:05
  • Please, post that as an answer and mark it accepted. – Lucio Oct 12 '15 at 16:36