FreeAllMedia / stimpak

An easy-to-use system for defining, discovering, and re-using code, text, and workflow patterns
http://stimpak.io
MIT License
8 stars 1 forks source link

Add a .transform feature #19

Open dcrockwell opened 8 years ago

dcrockwell commented 8 years ago

Per suggestion by @kdex:

// 1
stimpak.transform((stimpak, file, done) => {
    file.contents = beautify(file.contents);
    done(null, file);
});
// 2
stimpak.transform((stimpak, file, done) => {
    file.contents = beautify(file.contents);
    done(null, file);
});
stimpak.transform((stimpak, file, done) => {
    file.stem = `_${file.stem}`;
    done(null, file);
});
// 3
stimpak.transform((stimpak, file, done) => {
    file.contents = beautify(file.contents);
    done(null, file);
}).only("**/*", "/some/directory/name");
  1. make it so that each file has a chance to be transformed before writing.
  2. allow multiple transforms.
  3. allow transforms on files that match a provided glob