Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 29 02:46
    dependabot[bot] edited #160
  • Jun 29 02:45
    dependabot[bot] edited #160
  • Jun 29 02:45
    dependabot[bot] synchronize #160
  • Jun 29 02:45

    dependabot[bot] on npm_and_yarn

    chore(deps): bump node-fetch fr… (compare)

  • Jun 29 02:45
    dependabot[bot] edited #160
  • Jun 29 02:45
    dependabot[bot] edited #160
  • Jun 29 02:44

    shadowtime2000 on npm_and_yarn

    (compare)

  • Jun 29 02:44

    shadowtime2000 on master

    chore(deps): bump jsdom from 16… Merge pull request #174 from et… (compare)

  • Jun 29 02:44
    shadowtime2000 closed #174
  • Jun 29 02:44
    shadowtime2000 labeled #173
  • Jun 23 16:30
    dependabot[bot] labeled #174
  • Jun 23 16:30
    dependabot[bot] opened #174
  • Jun 23 16:30

    dependabot[bot] on npm_and_yarn

    chore(deps): bump jsdom from 16… (compare)

  • Jun 22 08:20
    shadowtime2000 labeled #171
  • Jun 22 08:20
    shadowtime2000 labeled #171
  • Jun 22 08:19
    shadowtime2000 commented #169
  • Jun 22 07:33
    shadowtime2000 closed #165
  • Jun 21 08:15

    shadowtime2000 on master

    README.ms: Fix rawgit links Merge pull request #170 from To… (compare)

  • Jun 21 08:15
    shadowtime2000 closed #170
  • Jun 09 10:40
    Josh-Cena opened #173
shadowtime2000
@shadowtime2000
@/all Hey, I would just like to gather all your opinions on maybe transferring from Gitter to Discord. I find when using Gitter it is much harder to keep track of messages and get notified when they come. I think such a change would make it easier for people coming in to ask questions or give feature ideas and stuff because Gitter is not as organized.
Emmanuel Segun-Lean
@LeanKhan
@shadowtime2000 yeah Gitter is not the best. But I haven't used Discord before so why not. Github has this new Discussions feature for repos have you considered that?
shadowtime2000
@shadowtime2000
@LeanKhan Yeah I know about discussions. They are pretty useful, but they aren't as great for stuff like just really really small problems that people are having with their code that they need help with.
Rubin Bhandari
@rubiin
can we include markojs benchmarks as well
shadowtime2000
@shadowtime2000
@rubiin What do you mean? As in including them in the benchmark? I don't think MarkoJS really fits as a template engine because it is more of an isomorphic UI framework
Simon Layfield
@simonlayfield
Hi all - I was wondering if there is a way to catch and display eta template errors in the browser? Using Express, and not sure how to go about it. Any help would be greatly appreciated.
shadowtime2000
@shadowtime2000
@simonlayfield I think you could just use a try {} catch (e) {} to do that inside of the request handler
Simon Layfield
@simonlayfield
Oh, yeah I'll try that.
Andre Mas
@ajmas_gitlab
Currently looking at moving from ejs to eta, but not sure how to inject variables, such that I don't need to do it explicitly it in every res.render() call
Not seeing anything mentioned in the docs and also trying to deal with i18n-express translation block not being available: Error: {} translate is not defined
Andre Mas
@ajmas_gitlab
okay, turns out it is the same, just by default accessible via 'it'
Avery Fay
@btmorex
Hi, I'm trying to use eta in a webworker and webpack is pulling in the cjs version (even though my config works for other npm packages). Anyone have any ideas? I wrote the following stackoverflow question because I'm not sure where the fault lies: https://stackoverflow.com/questions/67560485/webpack-targeting-webworker-wont-import-browser-version-of-a-dependency
Damian
@damiantoczek
Hi everyone, I want to use layouts but it doesn't work. So I have a layout.eta file that has <%~ it.body %> and a home.eta file that has <% layout('layout') %> and some html beneath. The layout renders but the home html doesn't show.
Simon Layfield
@simonlayfield
Hi all - what would be the best way to handle page titles (the html <title> tag) within layouts? Is there a way to avoid defining these every time a layout file is defined inside a template?
Simon Layfield
@simonlayfield
Ah, got it. Added to the route response.
TheoRelativity
@TheoRelativity
Hi everyone, someone tried to use eta with Hapi and vision? :)
NewtTheWolf
@NewtTheWolf

Hey Hey

I hope I can ask this here

How do layouts work?
How do I render a layout?

This is how I understood it:
I have a layout.ejs in which I put in the body <%~ it.body %>

I have an index.ejs where I put <% layout('layout/index') %> at the top but how do I render this now?

Emmanuel Segun-Lean
@LeanKhan
@NewtTheWolf whenever you render index.ejs it will put all the content inside it.body. So layout.ejs can have your navbar, footer etc. And index.ejs can just have some text or something unique to that page. You get?
NewtTheWolf
@NewtTheWolf

@LeanKhan I tried this before and it works flawlessly!

Thanks a lot for the answer!

dcd-api
@dcd-api
rendering in teh clientside is not working webpack give an error you cant use path (core node modules)
shadowtime2000
@shadowtime2000
@dcd-api Can you expand on what you mean? I haven't used Webpack in a bit, but I think you could reroute the import to import from the browser dist which doesn't use core node modules. I guess this is kind of related to #122
Mike Erickson
@mikeerickson
Hello, really liking ETA, it has made our templating interface much cleaner. However, one thing that has tripped me up is handling the situation where a given token may be missing for whatever reason. Using something like handlebars it will just silently resolve to empty (which is preferred) whereas ETA will throw an error. Is it possible to configure ETA to continue on error?
Coop
@CoopCoding_twitter

Hi, I'm trying to write a plugin for eta for cachebusting but I'm struggling a bit.
Here is my code:

const regex = /^\s*@cachebust\s*\(\s*["'`]([^"'`]*)["'`],?([^]*)\)$/gu

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function processAST(buffer: Array<string | { t: string; val: string }>, _: unknown): Array<string | { t: string; val: string }> {
  buffer.forEach(currItem => {
    if (typeof currItem === 'string') return

    if (regex.test(currItem.val)) {
      const firstHalf = currItem.val?.split('@cachebust(')[1]?.trim() as string
      currItem.val = firstHalf?.slice(0, firstHalf.lastIndexOf(')')).replace(/'/gu, ``) + Date.now()
    }
  })
  return buffer
}

export default { processAST }

Then in my index.eta I have :

  <link rel="stylesheet" href="<% @cachebust( '/css/index.css') %>" />

But I get an error message of css is not defined.
I'm just trying to append something to the string in the html.

Shakeel Osmani
@shakeelosmani

What does eta mean by TypeScript support out of the box is it in the .eta templates? For example can we do this:

<% const student: Student = new Student();%>
<% student.name = "Nerd" %>; 
<p> This students name is: <%- student.name %></p>

And more over will there be syntax highlighting and type-completion / inference.

Elton M.
@eltonmrk
I couldn't find any way to output the raw template content with all nested includes. Maybe one of you have an idea how to output the raw eta content (before rendering) ?
onjunPenguin
@onjunPenguin
The previously released extension for laravel MIx has been rewritten and published to npm.
https://www.npmjs.com/package/laravel-mix-eta
Kai Hendry
@kaihendry
I'm trying to figure out how you embed an image using eta
1 reply
CyberGitJul
@CyberGitJul
Hey guys, just wanted to ask how you can import structures like enum into templates to be able to use them there ?
Want to say something like <%= it.getItems(ItemType.LIGHTS) %>
But I get an error saying ItemType is not known
4e576rt8uh9ij9okp
@4e576rt8uh9ij9okp
Hi guys, I wanted to remember you that you need to update the gitter link in the eta footer because it redirects to a non existing room
4e576rt8uh9ij9okp
@4e576rt8uh9ij9okp

Can I include a file with "includeFile" inside a .eta file but also pass a value to the next eta that is being included?

For example index.eta has <head><%~ includeFile("style.eta") %></head> but the style.eta file has a string passed. Something like <head><%~ includeFile("style.eta", {path: newPath}) %></head> and inside the style.eta <link rel='stylesheet' href='<%~ it.path%>css/style.css'> In other words how do I pass a value to the next eta file from within a eta file?

4e576rt8uh9ij9okp
@4e576rt8uh9ij9okp
I found how, <%~ includeFile("nav.eta", {relative: it.relative}) %> I need to do "it."