Post-processors

Similar to the preprocessor the compiler output can be modified via registerPostprocessor

  1. import { registerPostprocessor } from '@riotjs/compiler'
  2. import buble from 'buble'
  3. // your compiler output will pass from here
  4. registerPostprocessor(function(code, { options }) {
  5. const { file } = options
  6. console.log('your file path is:', file)
  7. // notice that buble.transform returns {code, map}
  8. return buble.transform(code)
  9. })

In this case we make sure that the output code will be converted to es2015 via buble.