fastify / point-of-view

Template rendering plugin for Fastify
MIT License
338 stars 86 forks source link

feat: add support for eta@3.x #377

Closed multivoltage closed 1 year ago

multivoltage commented 1 year ago

Checklist

Goal

I want etajs@3.x support for this project. Hope my PR or other people want same feature

What I did not

Not edited documentation since probably I cannot say to be skilled enough in this project

What I did

I tried to make all the tests work by changing as few things as possible. Unfortunately, one big change involves creating an Eta instance with new Eta(). I had to change many parts of the tests. Not sure about many changes. Finally I started a test project by installing fastify, and linking index.js. I managed to get the basic example working:

import view from '../point-of-view-new'
import { Eta } from 'eta'

const eta = new Eta()

const fastify = Fastify({
    logger: true
  })

fastify.register(view, {
    engine: {
      eta
    },
});

// Declare a route
fastify.get('/', function (request, reply) {
    reply.view("/templates/hello.eta", { name: "diego" });
})
multivoltage commented 1 year ago

@mcollina maybe I should have created a special issue for this change?

mcollina commented 1 year ago

why?

multivoltage commented 1 year ago

Honestly I don't know. Is my second time I submit a pr ;)

aalfiann commented 1 year ago

I have issue, this PR doesn't work if eta using includeFile.

Eomm commented 1 year ago

Please open a new detailed issue adding a Minimal, Reproducible Example.