dependabot[bot] on npm_and_yarn
chore(deps): bump jsdom from 16… (compare)
shadowtime2000 on master
README.ms: Fix rawgit links Merge pull request #170 from To… (compare)
This is how I do it:
In my route... maybe after a login:
await req.flash('error', 'Something bad happened');
await req.flash('info', 'idk mehn, something happened sha');
await req.flash('success', 'Something good happened');
// bonus: I have this block in an app.use
// middleware so it captures all alerts for all routes
res.locals.alerts = {
info: await req.consumeFlash('info'),
error: await req.consumeFlash('error'),
success: await req.consumeFlash('success'),
};
Then in your template:
<% alerts.forEach(function(alert){ %>
<div>
<%= alert.message %>
</div>
<% }) %>
You can come up with something better that fits for usecase tho
let sessionStore = new session.MemoryStore;
const sessionConfig = {
secret: '[secret goes here]',
name: 'appname',
resave: true,
saveUninitialized: true,
store: sessionStore,
cookie : {
sameSite: 'strict', // THIS is the config you are looing for.
maxAge: 60000
},
secure: false
};
app.use(session(sessionConfig));
return res.render('pages/organization', {
user: req.user,
title: 'My Organizations',
organizations: orgDetails,
events: events,
errorMessages: await req.flash('error'),
infoMessages: await req.flash('info'),
successMessages: await req.flash('success'),
warningMessages: await req.flash('warning'),
dtFormat: require('dateformat')
});
I was wondering if anyone who uses the eta-vscode extension for language support in vscode would be able to tel me which version of vscode they're using. It seems it's incompatible with my version (1.45.1).
@simonlayfield :wave: Hey, I created eta-vscode
. I am running 1.54.3 and it seems to work fine for me
i18n-express
translation block not being available: Error: {} translate is not defined
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?
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.
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.