dcodeIO / MetaScript

Sophisticated meta programming in JavaScript, e.g. to build different versions of a library from a single source tree.
http://dcode.io
Apache License 2.0
137 stars 13 forks source link

You might be interested in the tool -- jdists #7

Closed zswang closed 8 years ago

zswang commented 8 years ago

example:MetaScript + EJS

input:

/*<jdists encoding="metascript" VERSION="1.0">*/
MyLibrary.VERSION = "/*?= VERSION */";
/*</jdists>*/

/*<jdists encoding="ejs" data="[1, 2, 3, '8 + 6']">*/
<% forEach(function (item) { %>
console.log(<%- item %>);
<% });%>
/*</jdists>*/

output:

MyLibrary.VERSION = "1.0";
console.log(1);
console.log(2);
console.log(3);
console.log(8 + 6);

Please refer to the more: https://github.com/zswang/jdists/tree/master/test/fixtures https://github.com/zswang/jdists/blob/master/processor/processor-metascript.js

Please know, Thanks.