alanshaw / grunt-include-replace

Grunt task to include files and replace variables. Allows for parameterised includes.
MIT License
200 stars 45 forks source link

Unexpected token error when trying to replace @@sample with html code #60

Closed janhaum closed 8 years ago

janhaum commented 8 years ago

I get an unexpected token error in terminal when trying the following:

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

nav.html
```...
<ul>@@list-items</ul>
...```
alanshaw commented 8 years ago

Error in your JSON there - you need to escape those quotes around the href attribute value.

janhaum commented 8 years ago

What about the # character? Can I solve that with backslash too ?

alanshaw commented 8 years ago

I don't think that's a problem in a JSON string.

janhaum commented 8 years ago

Thanks for your help, it works!