eta-dev/eta

From V2 to V3 and from `includeFile` to `include`

bacloud22 opened this issue · 7 comments

Hi,
I was using includeFile fine, and along with global configuration useWith: true, I have been using:

|--index.eta
|--  includeFile('head.eta', it)

|--head.eta
|-- // variables inside `it` just work
|-- // it is well present and loaded in V3

Now includeFile bugs so I changed it to include, along with useWith: true, but variables are not being passed.

Adding it. to each variable will be painful :/ so better to find a better way

Thanks a lot ^^

by the way everything suggested here does not work #254

(passing destructed {it}, or an empty object {})

@yanna92yar you should be able to do include('head.eta', it). Does that not work?

No it doesnt, it was that way also before with includeFile, so I didn't change that. Every partial has the parent calling with it

@yanna92yar could you give me a minimal example?

This is an example: https://github.com/yanna92yar/test-eta

If you check: https://github.com/yanna92yar/test-eta/blob/main/templates/partial.eta
and try to use variable without it it crashes.

Thanks a lot ^^

You need to pass the config directly into the Eta() constructor. In your repo,

  engine: {
    eta: new Eta.Eta({ useWith: true })
  },

Thanks a lot 🙏