views.js
This file
Path
benchmarks/views.js
56 lines · 1.2 KiB · JavaScript
Last changed by
Merge branch 'master' of git://github.com/visionmedia/expressciaranjbefore adoption046bee8
History of this fileTake it
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
require.paths.unshift('lib')require.paths.unshift('benchmarks')process.mixin(GLOBAL, require('sys'))process.mixin(GLOBAL, require('benchmark'))require('express')
print = puts
engine = { ejs: require('ejs'), haml: require('haml'), sass: require('sass')}
options = { locals: { article: { title: 'Foo', body: 'bar' }}}
ejs = ' \n\<div id="primary"> \n\ <div class="block first"> \n\ <h1><%= article.title %></h1> \n\ <p><%= article.body %></p> \n\ </div> \n\</div> \n\'
haml = ' \n\#primary \n\ .block.first \n\ %h1= article.title \n\ %p= article.body \n\'
sass = ' \n\red: #ff0000 \n\body \n\ ul \n\ li \n\ a \n\ :color !red \n\ :list-style none \n\'
suite('Template Engines', 1000, function(){ benchmark('ejs', function(){ engine.ejs.render(ejs, options) }) benchmark('haml', function(){ engine.haml.render(haml, options) }) benchmark('sass', function(){ engine.sass.render(sass) })})