custom_precompiler_subargs_test.js 640 B

12345678910111213141516171819
  1. var hbsfy = require("hbsfy");
  2. var concat = require("concat-stream");
  3. var assert = require("assert");
  4. var fs = require("fs");
  5. var templatePath = __dirname + "/custom_pre_compiler.hbs";
  6. // Subargs are just passed as the second argument
  7. // https://github.com/substack/node-browserify/blob/5cbf55a4397f300df69be574b59f3f30ac01b9c2/bin/advanced.txt#L81-L90
  8. fs.createReadStream(templatePath)
  9. .pipe(hbsfy(templatePath, { precompiler: "ember-template-compiler", precompilerOptions: false }))
  10. .pipe(concat(function(data) {
  11. assert(
  12. /hbsfy compiled Handlebars template/.test(data.toString()),
  13. "The template should be compiled"
  14. );
  15. }));