JavaScript templates engine PURE goes 2.0

It was in the pipe since a few weeks and it is now official: PURE v2 is out !

Download the library and get started!

Or simply take a look at the demos

New features

  • A total code review in functional JS (Thanks Rog Peppe for the jump)
  • ~8k when packed (35% less)
  • No more inside eval / new Function(). Less possible side effects and improved compile response time
  • More verbose error checks for easier debugging of templates and directives
  • Added support for dojo and Sly plus a standalone mode (dojo, domAssistant, jQuery, Mootools, Prototype, Sizzle and Sly are supported now)
  • All nested loops levels available within a function directive
  • Nested directives makes the code more natural and easier to maintain

There is a guide to help you migrate your templates to v2 if you are still using v1.

New documentation and website

We entirely reviewed the documentation and migrated it to our website.

And to make it even better, the design has received an extreme makeover.

Feedback

As always, feedback is more than welcome on the PURE discussion group.

PURE Version 2 Is Out For Trial

The new version of PURE, our OpenSource JavaScript template engine, is out for trial.

Please have a look at those new examples and download the version 2 for tests.

If you followed the story, you may know this new version is more about a change in the inner logic than a set of new features.

However we think this new architecture will enable us to go further with the library.

The main changes are described here: Version 2 Release Notes. You will also find in the article a mini-guide to upgrade your templates still using PURE version 1.

In the coming weeks, the wiki will be updated with a refreshed documentation.

Any suggestion, ideas about how to structure it in a better way is highly welcome.

Heads & hands to write some parts too ;)

Please have a look at the material above and send your feedback.

PURE Is Now Supporting Sizzle and MooTools

Yesterday, we were looking to adopt Sizzle (the new selector engine from John Resig) for PURE.

Today, we fully support it!

From now on, we are also supporting the JS library MooTools in addition to jQuery, DOMAssistant and Prototype

Once again, a big thank you to Carlos Saltos and Borja Vazquez for the MooTools support.

The source code and examples featuring the different libraries and Sizzle are available in our master repository

Only Dojo is still hanging in our development queue and any expert is welcome to help us on the task.

Just pass by our discussion group and let us know if you’re planning on doing something in this respect.

PURE Is Working With The JavaScript Framework Prototype

Thanks to the contribution of Carlos Saltos and Borja Vazquez our JavaScript Template Engine PURE is now working with the JavaScript Framework Prototype

The code is not in the master repository yet, but you can get it in the branch of PURE created by Carlos.

They are also working on the MooTools support.

With the announcement of the DOMAssistant support a few weeks ago, and jQuery initially, it is now three JavaScript libraries that are supported.

Stay tuned

Ruby Like Notation #{ … } To Mix Strings And Variables

New feature for our JavaScript template engine PURE

From revision 1.7 on, there is a new shortcut available to concatenate strings.

We’ll take a similar HTML as our basic Hello World example:

<div>
    Hello <span>World</span>
</div>

Now we remove the “Hello ” string:

<div>
    <span>World</span>
</div>

Here is the JSON we’ll use to render this HTML:

var json = { "name": "Mary" }

And now the directive that will link them both:

var dir = { "span": "Hello #{name}"}

Direct assignation continues to work.

For more information and examples, visit the dedicated Wiki page

Stay tuned

Our JavaScript Template (PURE) Becomes Cross-Library

We started the development of PURE with the clear goal of developing a cross-library JavaScript template engine.

Since we are using jQuery as our main JS library in the development of our BeeLit (called BeeBole now) solution, it was obvious to start with this one.

Today, we are happy to announce that PURE has moved another step closer to our initial goal as it now also works with DOMAssistant.

I must say, we haven’t really played a big role here. Everything started with a simple message on the DOMAssistant discussion group

Lim Cheng Hong (one of the three developers behind the library) took the challenge in his hands and made the 6 examples of our Getting Started page working with DOMAssistant in just two days.

You can discover those 6 examples with the DOMAssistant library here

So thank you Lim Cheng Hong and thanks to the DOMAssistant team.

We will soon update our wiki and the PURE website with those new examples.

The next steps will be to port PURE on Prototype, MooTools and Dojo.

If you are ready to get your hands dirty with those adaptations, your help will be more than welcome.

Stay tuned

Major Release for our JavaScript Template Engine – PURE

Thanks to your comments and the requests made on our discussion group we have been able to bring PURE to its next step.

This release contains a few corrections but also a lot of new features:

  • Auto-rendering: a new PURE method takes your HTML and your JSON data and merges them automatically. The class attribute is used to map the HTML and the data. (Read more about autoRender and its jQuery version on our Wiki).
  • Functions as directive are called by reference and not serialized
  • Change the id of the template root node (as any other attribute)
  • Better string value handling
  • Use of named properties in iteration “obj.prop” as well as “obj['name']“

We also made some changes to the PURE environment:

  • The source code moved from Google Code to GitHub

We are also actively looking for help in order to port PURE to other JS libraries such as DomAssistant, Dojo, Mootools, Prototype, YUI, …

If you are ready to get your hands dirty, just pass by the discussion group and leave us a message.

Stay tuned

PURE is running on the iPhone

As you may know, Belgium has some oddities.

One of them is a poor phone law that makes consumers pay the full price for a phone, probably one of the highest in the world. This doesn’t bring any cheaper usage cost than our neighbours either.

So it came as a kind of consolation when I saw PURE running smoothly on my brand new iPhone 3G.

Ok, it’s an easy shot as Safari is running there. But that’s good news for web applications using PURE.

Even if we’ll have to build specific screens for the smaller devices, we’ll be able to use the same technology, back-end services and share some templates between the desktop and the smart phone versions.

Moreover, the rendering speed was really good. We will show some benchmarks soon.

I can’t wait on what Google/HTC will ship in a couple of months.