-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
edge.js templates #417
Comments
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
Sure, sorry to say that I've never done a pull request so I'm reading your guidelines now and will make an attempt. |
never read about this engine. It's seem very big.
@johntom if you want help/collaborate I'm happy |
Yes would love the help and I don't think I'll have any issues with a pull request(pr) but have not gotten edge to work with fastify so didnt have anything to contribute, |
Ok, I think I have successfully created a pull request. |
I am not sure edge is a great fit for this plugin. Looking at https://edgejs.dev/docs/getting_started, it is ESM-only (whereas this entire plugin is CommonJS). |
I never got edge to work and was off converting a Fastify3/ commonJS to
Fastify4/ESM. To that end, the following code will let you require files
with esm
'use strict'
import fp from 'fastify-plugin';
import os from 'os'
const drive = process.env.drive;
// The following fixes common libs when you cant import
import { createRequire } from "module";
const require = createRequire(import.meta.url);
// End of fix
console.log(" chilkat================== ")
if (os.platform() == 'win32') {
if (os.arch() == 'ia32') {
var chilkat = ***@***.***/ck-node20-win-ia32');
} else {
var chilkat = ***@***.***/ck-node20-win64');
}
}
// esm does not support loading json and if fixed with this snippet
const books = require("../json/books.json")
…On Mon, Mar 25, 2024 at 10:29 PM Matt Weber ***@***.***> wrote:
I am not sure edge is a great fit for this plugin. Looking at
https://edgejs.dev/docs/getting_started, it is ESM-only (whereas this
entire plugin is CommonJS), and it looks like it has HTTP routing and
middleware built in, just looking at this getting started example, I am not
sure how Fastify fits in:
import { Edge } from 'edge.js'
import { createServer } from 'node:http'
const edge = Edge.create()
edge.mount(new URL('./views', import.meta.url))
const server = createServer(async (req, res) => {
const data = { username: 'virk' }
const html = await edge.render('home', data)
res.setHeader('content-type', 'text/html')
res.end(html)
})
server.listen(3000)
—
Reply to this email directly, view it on GitHub
<#417 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOKLADSYXNJMOSXEA56EOTY2DMRJAVCNFSM6AAAAABD6LX7A2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJZGI3TENRXG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Prerequisites
🚀 Feature Proposal
I just came across edge.js templates from "htmx discord link" and think this would be a strong addition to point-of-view.
Motivation
While I'm currently using nunjucks as my templating engine, many users on discord feel they will never add partials which is a feature I'd like to test with htmx. I also find https://edgejs.dev/docs/introduction very clear and concise.
Example
No response
The text was updated successfully, but these errors were encountered: