Skip to content
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

Pug support #10

Closed
jaymakes11 opened this issue Dec 11, 2020 · 12 comments
Closed

Pug support #10

jaymakes11 opened this issue Dec 11, 2020 · 12 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jaymakes11
Copy link

Would love to test out and use lume, but not without it supporting Pug (the thought of writing actual HTML after using Pug makes me shiver).

Is this currently possible?

@shadowtime2000
Copy link
Contributor

You would probably just need to create a plugin like the Eta one. For Deno compatibility you could just use a CDN like esm.sh.

@oscarotero
Copy link
Member

Yes, if we are able to run Pug in Deno, it would be easy to create a plugin for lume, as we have for Eta, nunjucks or jsx.

I don't think automatic conversion with esm.sh is possible here, because these conversions don't work when we have to use the filesystem (for example to handle includes https://pugjs.org/language/includes.html) and seems like Pug don't have plans to support Deno yet (according with pugjs/pug#3255).

One solution is creating a fork (as we have done with denjucks/nunjucks).

@jaymakes11
Copy link
Author

Yeah, forking Pug seems the most feasible approach for this in the near future. Wish I had the bandwidth to take on something like that.

Should any others, many +1s for your efforts. I'll be the first to start your repo :)

@oscarotero
Copy link
Member

@yet-another-dev I've created this work in progress repository with the code of Pug: https://github.com/lumeland/pug

There are still some few dependencies that need to be changed (those that are imported with CJS like this)

If anyone want to help me with this, I'd could create then a plugin include Pug support for Lume.

@oscarotero oscarotero added help wanted Extra attention is needed enhancement New feature or request labels Dec 13, 2020
@shadowtime2000
Copy link
Contributor

Yes, if we are able to run Pug in Deno, it would be easy to create a plugin for lume, as we have for Eta, nunjucks or jsx.

I don't think automatic conversion with esm.sh is possible here, because these conversions don't work when we have to use the filesystem (for example to handle includes https://pugjs.org/language/includes.html) and seems like Pug don't have plans to support Deno yet (according with pugjs/pug#3255).

One solution is creating a fork (as we have done with denjucks/nunjucks).

@oscarotero esm.sh does automatically fill in Node specific libraries with the deno std node compatability library. It may be a little hard to look at but the pug build is importing the result of deno bundle --unstable https://deno.land/std/node/fs.ts from here.

oscarotero added a commit that referenced this issue Dec 15, 2020
@oscarotero
Copy link
Member

oscarotero commented Dec 15, 2020

@shadowtime2000 Wow, I didn't know esm.sh could do that (I've assumed that it was something similar to jspm.
Thank you!

I just added support for pug and seems to work fine (71e0cf1), so no need to create and maintain a fork.

@yet-another-dev In the next version there will be a plugin to activate it.

@probins
Copy link
Contributor

probins commented Dec 15, 2020

from jspm/project#50 (comment) it looks like jspm is currently adding this as well.

@probins
Copy link
Contributor

probins commented Dec 15, 2020

does that mean you can use nunjucks directly as well, rather than the denjucks fork?

@shadowtime2000
Copy link
Contributor

@probins Yeah, probably does mean we can transfer from having to use a fork of Nunjucks. Using esm.sh really opens us to use many more NodeJS template engines.

@probins
Copy link
Contributor

probins commented Dec 15, 2020

but it's only for those functions covered by Deno's Node compatibility layer, right? So it doesn't include for example net? A pity, as I use an API with my smart home software that I would prefer to run under Deno :-(

@shadowtime2000
Copy link
Contributor

We should probably add a note for the plugins that says that it may be better to use template engines with native Deno support because those will probably have better support and stuff with errors and other problems.

@oscarotero
Copy link
Member

v0.10.0 released including the Pug plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants