FreeAllMedia/stimpak

Add a .transform feature

dcrockwell opened this issue · 0 comments

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