Skip to content


Subversion checkout URL

You can clone with
Download ZIP
dual side templating, made easy
CoffeeScript JavaScript
Branch: master
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src update example
.gitignore new build system
.npmignore new build system
Cakefile new build system update readme
lift.js new build system
package.json fix npm commands

node lift

dual side templating, made easy.

this library simplifies templating by lifting parts of a template to the client. these parts will be processed, when the client got all data.


npm install lift

server side api


LiftState = require('lift')
lift = new LiftState()

it actually returns a function, so lift is callable. the LiftState instance can be accessed via lift.self.


lift(id, static_args..., function ([static_args...], [dynamic_args...], [data]) {…})
  • static_args arguments defined on server side
  • dynamic_args arguments given on client side
  • data given on client side

this defines a function that can run on server or client (decision can be made per request by calling or lift.get before). it is best used in the views to define lazy template parts., args..., data)

sets the arguments of given id-part. when id-part gets defined it will be called direct. useful to render parts on server side.


lift.get(id, function (lifted_function) {…});

define a function that will be invoked with the requested id-part. useful to render parts on server side.


client_side_code = lift.code() // or LiftState.code()
script_tag = '<script type="text/javascript">' + client_side_code + '</script>'

returns client side code. only needed once per request.

client side api


lift || window.lift // same

this is the client side of the library. it returns from LiftState.code()., [dynamic_args...], [data])
  • dynamic_args arguments defined on client side
  • data defined on client side

this invokes the id-part at the client defined on server side.


fun = lift.get(id, [dynamic_args...])
  • dynamic_args arguments defined on client side
  • data defined on client side

similar to but just returns a function containing all server and client side arguments and the id-part.



it prints the context to the console. the context contains every function and its arguments defined by calling lift on server side.


this library does not specify on which channels (, ajax, comet, jsonp, etc …) the data is passing to the client.


the example server should explain everything else.

influenced by lifts lazy load idea.

Something went wrong with that request. Please try again.