Serve / JSPP
This module provides a Javascript Pre-processor implementation for use in web applications.

This is very much only a proof-of-concept and will most definitely be rewritten entirely.


var JSPP = Serve.module('JSPreProcessor/libJSPP');

// Although designed for use with HTML templates, any template
// where <? and ?> won't exist will also work.
var template = `<html>
<title>Hello, <? this.INT__SEND(params['name']); ?></title>
This is just a message from <? this.INT__SEND( myName() ); ?>.

// A mapped object can be passed to a template object:
var params = { 'name':'Joe' };

// Functions from the global object can also be called from within a template:
function myName() {
        return 'JSPP';

// This converts the template into eval-able code:
var code = JSPP.process(template);

// This runs the resulting code, returning the generated object for us to use:
var obj = Serve.eval(code);

// Finally, we can operate on the resulting object:
var output = obj.process( params );

// And clean up the object:
JSPP.destroyObject( obj );




<title>Hello, Joe</title>
This is just a message from JSPP.


Page generated in 1.212004ms.

Design based on Falkon design, which is in turn based on the Swift theme for Jekyll.

Highlight.js used in portfolio section for syntax highlighting.