Using ECO plugin for Docpad I could achieve what I was looking for.
I can get both values and call helpers from docpad templateData.
Question
Is there a DocPad plugin that could pre-process the js files and use templateData variables and helpers to get configuration values available?
I've tried Hogan, I can get the variables but not call the helpers...
Solution
Using ECO plugin for Docpad I could achieve what I was looking for.
I can get both values and call helpers from docpad templateData.
OTHER TIPS
Any templating language will work here are a few examples and their matching templateData variables:
/docpad.coffee
docpadConfig = {
templateData:
site:
url: "http://www.example.com"
}
/src/documents/index.html.eco
<p>My site is <%= @site.url %></p>
/src/documents/index.html.coffee
p "My site is " + @site.url
Or within a script file:
/src/documents/scripts/scripts.js.coffee
console.log( @site.url )
/out/scripts/script.js
console.log("http://www.example.com");
/src/documents/index.html.hogan
<p>My site is {{@site.url}}</p>
/src/documents/index.html.jade
p My site is #{site.url}