custom_compiler_subargs_test.js 704 B

1234567891011121314151617181920212223
  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, { compiler: "Ember.Handlebars" }))
  10. .pipe(concat(function(data) {
  11. assert(
  12. /hbsfy compiled Handlebars template/.test(data.toString()),
  13. "The template should be compiled"
  14. );
  15. assert(
  16. /Ember.Handlebars/.test(data.toString()),
  17. "compiled should have compiler set"
  18. );
  19. }));