meteor / meteor

Meteor, the JavaScript App Platform
https://meteor.com
Other
44.39k stars 5.19k forks source link

Jade template language support #294

Closed bmcmahen closed 12 years ago

bmcmahen commented 12 years ago

The documentation on the meteor website makes numerous references to using Jade as a template language, but it doesn't seem like support for it actually exists yet. Is this something that is still being worked on? After using Jade for numerous other sites, it will be hard for me to go back to writing plain html.

possibilities commented 12 years ago

BTW the docs say: "Today, the only templating system that has been packaged for Meteor is Handlebars."

I remember hearing (but I can't remember where) that someone started integrating Jade and found that the existing template API was insufficient to achieve the same integration as handlebars and the new template API is supposed to address this.

TaraRed commented 12 years ago

You can run Jade by creating a smart package jade that contains a package.js that contains:

Package.describe({
  summary: "Jade template engine"
});

var jade = require('jade');
var fs = require('fs');

Package.register_extension(
  "jade", function(bundle, source_path, serve_path, where) {
    serve_path = source_path + '.html';
    var options = {};
    jade.renderFile(source_path, options, function(err, html) {
      if (err)
        console.log(err);
      fs.writeFileSync(serve_path, new Buffer(html));
    });
  }
);

Then, run meteor add jade; this will turn .jade files into .html files.

This is not the best approach, but works for using Jade instead of HTML...

bmcmahen commented 12 years ago

Thanks for the potential work-around. Does the last solution mean that I'd still use the Handlebars syntax for variables, loops, etc.?

crapthings commented 12 years ago

use blade template its jade syntax totally with extra good feature you can use many file as you want

badslug commented 12 years ago

@bminer

https://github.com/bminer/node-blade

Using Blade with Meteor

debergalis commented 12 years ago

As above, we'd take a PR for a Jade smart package (or publish it in Atmosphere, but it's "Hard". Closing the issue.

Charuru commented 12 years ago

How much work is required to get jade working with meteor? This is a serious impediment to getting started with meteor for many node devs.

bminer commented 12 years ago

@Charuru - I am working closely with the Meteor dev team to get Blade working with Meteor. As mentioned above, Blade is like Jade, but a little different. Check it out.

Charuru commented 12 years ago

UPDATE: Meteor 0.4.0 support is coming soon! Thanks for your patience!

@bminer I checked it out but this is from the readme. So I assumed it's not ready yet.

bminer commented 12 years ago

@Charuru - Correct, it's not quite ready yet. Although you can still use Blade with Meteor at this time, there are a lot of missing features (i.e. preserved elements, "constant" blocks, and "isolates"). There are some features in Blade (just like some in Jade) that don't work all that well with Spark. I'm working with @dgreensp to get this working ASAP. We should have something pretty close in the next few weeks!

Charuru commented 12 years ago

@bminer I would really appreciate documentation on what blade features don't work with spark. I have read the wiki page, and blade seems like it will cure my templating annoyances.

Will blade work on the server side for SEO? I understand that Meteor is working on that.

bminer commented 12 years ago

@Charuru - Good question. There are some features that Spark provides that Blade cannot take advantage of yet. For example, Blade does not properly insert branch labels or landmarks, so I'm not quite sure if element preservation works all that well, if at all. Also, Blade does not yet support "constant" regions like Handlebars does. More information can now be found on the Blade + Meteor wiki under the Troubleshooting and Known Issues section.

Will blade work on the server side for SEO? I understand that Meteor is working on that.

I don't know the answer to this one. That's more of a Meteor-related question.

Charuru commented 11 years ago

@bminer How is it going on constant regions? I'm honestly dying here on handlebars.

bminer commented 11 years ago

@Charuru - constant regions are now working. Blade 3.0.0 stable release is coming soon. Please feel free to test out the beta version and report any bugs. Thanks!

BrandonCopley commented 10 years ago

Is Blade stable to be used yet? it's been a yr - I haven't seen any updates.

freefrancisco commented 10 years ago

What is the recommended or most popular way right now (Meteor release 0.7.1.2) to use Jade (or Blade) along with Coffeescript and Stylus? Is it the package blade, jade, jade-handlebars, jade-handlebars-refactored, or none of the above? I was trying to setup a default template to start new applications with the package that seems to have the most activity in Atmosphere, jade-handlebars-refactored, but I couldn't get it to work. Should I write my own package for jade, or is one of the jade packages the current default recommendation?

BrandonCopley commented 10 years ago

I couldn't get any of these things working - I wrote a bash script that converts all of my jade files to html though and I just run that before launching the meteor.

On Thu, Feb 27, 2014 at 3:49 AM, Francisco Gutierrez < notifications@github.com> wrote:

What is the recommended or most popular way right now (Meteor release 0.7.1.2) to use Jade (or Blade) along with Coffeescript and Stylus? Is it the package blade, jade, jade-handlebars, jade-handlebars-refactored, or none of the above? I was trying to setup a default template to start new applications with the package that seems to have the most activity in Atmosphere, jade-handlebars-refactored, but I couldn't get it to work. Should I write my own package for jade, or is one of the jade packages the current default recommendation?

Reply to this email directly or view it on GitHubhttps://github.com/meteor/meteor/issues/294#issuecomment-36225999 .

http://novationmobile.com/

Brandon Copley

CEO & FOUNDER

PHONE::: 512.784.6060 EMAIL::: copley.brandon@gmail.com copley.brandon@gmail.com WEBSITE::: http://novationmobile.com/ http://www.novationmobile.com

avital commented 10 years ago

If you're using Blaze (on the shark branch), you can try http://atmosphere.meteor.com/package/jade.

For more information see http://github.com/meteor/meteor/wiki/New-Template-Engine-Preview