
Explore how the Universal Commerce Protocol (UCP) allows AI agents to connect with merchants, handle checkout sessions, and securely process payments in real-world e-commerce flows.

React Server Components and the Next.js App Router enable streaming and smaller client bundles, but only when used correctly. This article explores six common mistakes that block streaming, bloat hydration, and create stale UI in production.

Gil Fink (SparXis CEO) joins PodRocket to break down today’s most common web rendering patterns: SSR, CSR, static rednering, and islands/resumability.

@container scroll-state: Replace JS scroll listeners nowCSS @container scroll-state lets you build sticky headers, snapping carousels, and scroll indicators without JavaScript. Here’s how to replace scroll listeners with clean, declarative state queries.
Would you be interested in joining LogRocket's developer community?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up now
5 Replies to "Pug.js tutorial: A beginner’s guide with examples"
Who still implement express when it’s natively supported with vue cli or nuxt ? And vite / snowpack.
And if you want to format pug, I offer explicit support for vue in my https://github.com/prettier/plugin-pug
I have just made `pug-vue-loader`, a replacement for `pug-plain-loader` that allows you to use _proper_ pug syntax in your Vue pug templates, to access Vue state in native pug `each`/`for` blocks, as well as `if`/`else` etc… and also use proper pug variable interpolation eg `li= someVarFromVue` or `li normal text #{someVarFromVue}`
If you like real pug syntax and want to use its first-class loops/conditionals etc in your Vue templates, check it out:
https://www.npmjs.com/package/pug-vue-loader
As an example, instead of this:
“`pug
ul
li(v-for=”item in items”)
a(v-if=”item.type == ‘link'” :href=”item.url”) some link title: {{item.title}}
p(v-else) {{item.content}}
// …Vue component JS
“`
The `pug-vue-loader` lets you do this:
“`pug
ul
for item in items
if item.type == ‘link’
a(:href=”item.url”) some link title: #{item.title}
else
p= item.content
// …Vue component JS
“`
Since it’s new, would like to get people using it, reporting any issues etc. Cheers
this tutorial doesnt run. First you get errors that babel core was installing the wrong version, then you get vue not found in node_modules so the import would fail when you try to build. After I fix those I get a 404 error when the home.pug tries to load the script.
Thank you for this tutorial.
As of today, still the same. The first part is working. But then installing Vue and trying to use webpack, no file public/js/home.bundle.js gets compiled when running
npm run dev
So either fix this tutorial or mark it as outdated?