kruppel / doppel

Copy & compile a directory template
http://kruppel.github.io/doppel
0 stars 0 forks source link

Support for doppeling (doppelling?) filenames? #6

Open repeatingbeats opened 11 years ago

repeatingbeats commented 11 years ago

Having just started a new Node module, I once again returned to the idea of using a tool like doppel to set up my boilerplate. This is all very straightforward for the contents of files, but what about the filenames themselves?

My main entry point to a module is usually in lib/{{moduleName}}.js. Current doppel gives me lib/index.js, but having a construct that allows rendering of content into filenames would let me do my preferred style off the bat.

Additionally, thinking about a Rails-style generator use case, the ability to contextually render filenames would be important.

Thoughts? Obviously not a blocker on publishing.

kruppel commented 11 years ago

My main entry point to a module is usually in lib/{{moduleName}}.js. Current doppel gives me lib/index.js, but having a construct that allows rendering of content into filenames would let me do my preferred style off the bat.

Seems simple enough. Should be able to handle that after the compilation step.

Additionally, thinking about a Rails-style generator use case, the ability to contextually render filenames would be important.

I'm hesitant in making this into a generator in the vein of yeoman or Rails without having a better idea of how it'd be used. Contextually rendering filenames based on the destination filename is one thing. It might be an onerous task to deal with the properties set in the context object/file, however, i.e. doppel -d '{ "a": 1 }' src a is going to be a tricky case if you have a file named {{a}}.js.handlebars.

That said, I'll give it some more thought. Initially, probably just use destination as a key (which should work for your case). Later, I'll look into creating a use case for rendering filenames by context.

That also reminds me, I need to add options for supplying helpers and partials...