One of the “blocking” factors in learning to use Bedrock is that you have to know how to work with Jade.
Jade is a powerful templating language built on top of node.js.
The first time I encountered Jade I thought it was unnecessary to abstract HTML into something else. But after a few months on a project using Jade, going back to HTML felt tiring. You really have to type double as much code when you are writing HTML.
The main advantage of Jade is that you can’t forget to close HTML tags: the way that Jade works just doesn’t allow for that to happen. This reduces code mistakes significantly.
What I mostly love about Jade is blocks and extending templates. This system is explained here. I make use of this extensively to make sure I never have to write duplicate code in a project.
I made a screencast how Jade is used in Bedrock:
Who else is using Jade out there?
5 thoughts on “Jade”
I’ve been through the same process a few years ago. First there was HAML, but it was still pretty verbose and convoluted so I disregarded it quickly. Then I worked on a project with Jade and came to love it. I’ve since been using Jade and Slim (a pretty similar syntax) wherever I can.
Likewise with CSS preprocessors. First I was really into Less, because its syntax was so close to regular CSS. Then I came to realize the advantages of Sass, and specifically the original sass syntax. But soon after I discovered Stylus, and never looked back.
I like Sass’s original syntax because that’s how I got to know Sass. But when they switched to SCSS I thought that was reasonable because I saw the problems with people having to learn the syntax.
I should give Stylus a try then, but I don’t like learning something new just for the sake of it, I’d rather have some project force me to use it so I can give my opinion of usage in a real-world situation afterwards. I’ve actually never learned to work with Less because I never had to.
This is exactly like PHP’s Twig.
And Twig was inspired by Django’s Jinja.
See http://fabien.potencier.org/templating-engines-in-php.html. Would be nice if Jade acknowledged this too.
Yes. When I first learnt about extends it reminded me of Smarty, which I guess is also similar. Block inheritance ftw.