Replies: 14 comments 1 reply
-
Try print html and template before set to DOM by console.log I tried this and it works: https://liquidjs.com/playground.html#PHRhYmxlPgogIHslIGZvciBpdGVtIGluICgxLi4zKSAlfQogIDx0cj4KICAgIDx0ZD57e2l0ZW19fTwvdGQ+CiAgPC90cj4KICB7JSBlbmRmb3IgJX0KPC90YWJsZT4=,e30= |
Beta Was this translation helpful? Give feedback.
-
@harttle do you mean something like this?
|
Beta Was this translation helpful? Give feedback.
-
So I tried this and got an even odder result, I added
|
Beta Was this translation helpful? Give feedback.
-
It seems complicated, could you create a minimal runnable snippet to demonstrate the problem? Then I can help. |
Beta Was this translation helpful? Give feedback.
-
I am using it inside Grist (https://www.getgrist.com/), as a custom widget, I cannot reproduce it in the playground, so I guess it can be affected by the iframe or Grist own JS, the custom part is the JS I added in the 1st comment. I could create the same example in Grist and share it with you That said, I wonder why it behaves different based on which tag is surrounding the code, is that expected? |
Beta Was this translation helpful? Give feedback.
-
Here is the env with public access: https://docs.getgrist.com/a8X5yeTvzGx2/Invoicing-copy Here is the custom code: https://github.com/jalberto/grist-widget/tree/master/ja-invoices-es I really appreciate any clue you may have. Thanks! |
Beta Was this translation helpful? Give feedback.
-
No, LiquidJS is HTML agnostic. It can be used to generate HTMLs and there's people who use LiquidJS to generate C++ code. |
Beta Was this translation helpful? Give feedback.
-
Please change this line: to console.log('template:', template, 'ctx', ctx);
const html = engine.parseAndRenderSync(template, ctx);
console.log('html', html); and post the console log here. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Note this part: <section class="detaills">
{% for item in (1..3) %}
{% endfor %}
<table>
<tbody><tr>
<th>Concepto</th>
<th>Base unit.</th>
<th>Total</th>
</tr><tr>
<td>{{ item }}</td>
</tr></tbody></table>
</section>
|
Beta Was this translation helpful? Give feedback.
-
Thanks! So yes, now the output is in the correct place, but the item still empty when called within |
Beta Was this translation helpful? Give feedback.
-
It seems the problem is the same :(
|
Beta Was this translation helpful? Give feedback.
-
The only way to make it work as expected is to wrap all the template in a |
Beta Was this translation helpful? Give feedback.
-
Ran into this too, and figured out comments work too (which IMHO feels less "invasive" and works better with my code highlighter too):
|
Beta Was this translation helpful? Give feedback.
-
Works as expected, but
Produces this:
more context:
I also tried the
template
andresult
divs strategy, but I get same result.This is rendered inside an iframe, maybe is there some option I need to enable to make it work?
Beta Was this translation helpful? Give feedback.
All reactions