posthtml-expressions icon indicating copy to clipboard operation
posthtml-expressions copied to clipboard

Each loop not working

Open thewebartisan7 opened this issue 3 years ago • 3 comments

In read me there is this example:

<each loop="item in [1,2,3]">
  <p>{{ item }}</p>
</each>

But it seem not working.. Only when passing array via locals.

Also adding below not working:

<script locals>
	module.exports = {
		inputs: [2,3,4,5,6]
	}
</script>

<each loop="item in inputs">
  <p>{{ item }}</p>
</each>

thewebartisan7 avatar Feb 02 '22 07:02 thewebartisan7

All loop tests pass and that works fine, can you please share a repository that reproduces the issue?

cossssmin avatar Apr 26 '22 11:04 cossssmin

All loop tests pass and that works fine, can you please share a repository that reproduces the issue?

I can't find in your test the example of this way to define locals:

<script locals>
  module.exports = {
    name: 'Scrum'
  }
</script>

<div>My name: {{name}}</div>

Because this is what I am trying.

Should I prepare a repo with this?

I am using posthtml-loader with webpack.

thewebartisan7 avatar Apr 27 '22 07:04 thewebartisan7

It's here:

https://github.com/posthtml/posthtml-expressions/blob/260a048538e78f79d9d62e15961ecd6f4129d399/test/test-locals.js#L34-L40

Should I prepare a repo with this?

Yes please if you can, thanks.

cossssmin avatar Apr 27 '22 08:04 cossssmin