I like coffeescript and I like haml-based template engines. Im trying to figure out how do I use Jade with CoffeeScript? And I dont mean client scripts embedded in html, I mean server side logic.
Actually I found package exactly I want, but its very outdated: jade-coffee
Any suggestion for this?
I'm unsure if I'm understanding the question right or not but if you are trying to write coffeescript in jade you can make use of the Jade language filters.
http://jade-lang.com/reference/filters/
Hope this helps!
Related
Is it really necessary to learn PUG for template engines in NodeJS development, my question is, would there be anything wrong if I convert my HTML to PUG by using a VS code extension(html2pug) instead of learning PUG ,learning PUG could be useful, but will this extension not save lots of manual effort? What's you advice here?
Please also advice if anything particular needs to be learnt in PUG?
We are using NodeJS + Express + Handlebars and it works just fine. Now we wont to use Markdown for our documentation. I looked for several days to find something I can use, and the best choice right now is mix of those packages
https://github.com/tj/consolidate.js
https://www.npmjs.com/package/marked-engine
and than register new app engine
app.engine('md', require('marked-engine').renderFile);
The main problem is that I can't use my handlebar layouts with this, so it would be great if there is another approach which would allow me to render Markdown inside handlebar layouts. And I would like to achieve that without Asemblio, Grunt or anything similar if it is possible.
Thank you in advance,
Jovan
This is a tipical use case for a filter in template engines like handlebars. So a fast google search for filters in handlebars lead me to this npm package. And a quick look to the docs show this
{{filter "## Hello *World*!" "markdown"}} → «<h2>Hello <em>World</em>!</h2>»
So maybe this is exactly what you are looking for, in case that this won't work, you should still look for filters, thats the way to go for your problem.
PS: I haven't tested this particular package
Using Node.js and express in a MEAN environment, I am looking for a simple and straightforward template engine, meeting these requirements:
does not dictate me to only use its own weird syntax but allows me to keep writing webpages using pure/plain html and js
supports conditional includes
works with express
operates on server-side (Node.js/Express)
executes freakin' fast ;)
Basically I just want to slice my webpage into several modules (e. g. header, footer, ...) and include those now and then based on simple conditions. I don't want to entirely (re-)rebuild all webpages using a proprietary template language but rather prepare a few html modules that I concatenate at runtime (comparable to PHP where I just use the include instruction to paste prepared html code).
I had a look at http://garann.github.io/template-chooser/ and https://github.com/nodejs/node-v0.x-archive/wiki/modules#templating but the sites seem outdated and according to them, there ain't no template engine available fully meeting my requirements!?
Suggestions anyone?
I think ejs is more natural for what you are looking for https://scotch.io/tutorials/use-ejs-to-template-your-node-application, but jade can work also. The example in the link uses partials, which you dont need to use if ur just rendering a single page
I am trying to apply mvc pattern (as in ruby) using node.js. I would like also to use a common layout and partials. I saw this post and I tried Locomotivejs, but I don't know how to apply a common layout and partials with Locomotivejs. Should I use another frameworks? if I should, which one has all these features? Could you please give me some suggestion?
You can see what I did in order to solve that problem with locomotive.js here:
I recently wrote using Jade Template for NodeJS. When talking with my manager.. I found that we use Dust within company. Thus I was required to switch over to dust.
While following the DRY principle.. I don't want to do this manually.
Is there good translator/parser to parse existing Jade template to Dust? I searched online but didn't found.
Additionally, if there's no such template, what about I go and implement one myself? I took compiler course before and thinking this would probably be not-to-hard to implement. But I never tried... and don't really understand the Dust template yet. how do you think of the difficulty of doing one parser myself?