How to create file templates and includes


I would like to write my own file templates which prefills some parts dynamically, but I couldn't find any good documentation about file templates. Perhaps you can help me for a specific use case: A JavaScript file in "public/javascript/my_namespace/my_class.js" with a file template should produce the following:

MyNameSpace.MyClass = function(){};

So I would like to convert "public/javascript/my_namespace/my_class.js" dynamically into MyNameSpace.MyClass [1] - how to achieve this?

Thank you!

[1] "public/javascript/my_namespace/my_class.js".gsub("public/javascript/",  "").gsub(/\.js$/,"").split("/").map(&:camelize).join(".")

Comment actions Permalink

Nobody has done something similar?

Comment actions Permalink

Hello Kai,

Unfortunately it isn't possible, please file an issue -


Please sign in to leave a comment.