What is Pug?
Who uses Pug?
Why developers like Pug?
Here are some stack decisions, common use cases and reviews by companies and developers who chose Pug in their tech stack.
We chose Pug because writing raw HTML is about as enjoyable as a fart in a spacesuit, and writing decently-rendering HTML for enterprise email clients is a soul-sucking type of black magic.
Object parameter - once that concept takes hold, you'll quickly swear off angle brackets in favor of neatly indented and extensible e-mail, invoice, and reporting templates.
jstransformer filter for instant interop with just about every preprocessor ( Stylus , in our case) and file format out there. Pass that compiled HTML though Juice on Node.js and bam - rugged HTML-emails that hold up in even the wonkiest Lotus Notes clients.
That the end result is 'just HTML' is the final cherry on top. Debugging needs only DevTools, and Puppeteer 's now all you need to create fancy-pants PDFs to your heart's content.
This is the third Stack Decision of this series. You can read the last one to catch up (link below).
Josh is a machine. He cranked out the rewrite of the site and as well as the Amazon S3 syncing/permissions/
content-type scripts in less than a week (with a full time job + 2 small kids at the time). The new site had/has a section where you could try out all of the Bootswatch themes on our site and while it might sound silly, it showed me that he goes above and beyond and I totally lucked out.
Anyway, Josh decided to go with Node.js, ExpressJS, Jade (now called Pug), and configs with #yaml, all things I have read about but never used in production. I quickly found out Josh was a Vim user (still is), because every Jade file he worked on had
//- vim: ft=jade sw=4 sts=4 et: at the bottom.
Everything was running smoothly, I was encouraged by David (co-founder from part 1) to take a vacation. I took him up on that. Unfortunately, my timing couldn’t have been worse. More on that in part 4.
AMA below 👇
For markup and style, I used Pug and Sass, since they’re the perfect match to me. I love the clean and strict syntax of both of them and even more that their structure is almost similar. Also, both of them come with an expanded functionality such as mixins, loops and so on related to their “siblings” (HTML and CSS). Both of them require nesting and prevent untidy code, which can be a huge advantage when working in teams. I used JSON to store data (since the data quantity on my website is moderate) – JSON works also good in combo with Pug, using for loops, based on the JSON Objects for example.
To send my contact form I used PHP, since sending emails using PHP is still relatively convenient, simple and easy done.
DevOps: Of course, I used Git to do my version management (which I even do in smaller projects like my website just have an additional backup of my code). On top of that I used GitHub since it now supports private repository for free accounts (which I am using for my own). I use Babel to use ES6 functionality such as arrow functions and so on, and still don’t losing cross browser compatibility.
Side note: I used npm for package management. 🎉
We use Jade when writing HTML, which is much easier to read and maintain. We compile it to HTML before deploying it though, and don't use Jade's client-side rendering features. Pug
We use Jade for constructing our modular UI. We also rely on Jade interpolation to pass reactive and static values from our Express server. Pug