gruntjs / grunt-contrib-pug

Compile Pug templates.
http://gruntjs.com/
MIT License
328 stars 77 forks source link

Can we please have processOutput buildoption #170

Closed RachelSatoyama closed 8 years ago

RachelSatoyama commented 8 years ago

So basically I believe it would be beneficial to have an opportunity to postprocess generated output just like we can process content via processContent option. My use case is pretty simple - I want do add typescript-style export declaration to the generated file. Yet I easily can imagine that there are some other scenarios where this can be handy.

The change is pretty straightforward and can be something like:

  var outputString = output.join(grunt.util.normalizelf(options.separator));

 if (options.processOutput) {
        outputString = options.processOutput(outputString);
}   

(plus docs and tests) So I'll be very glad to proved PR if the very idea is not something the community is against of.

shinnn commented 8 years ago

Should be done by another Grunt plugin.