Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

invoke jade parser

  • Loading branch information...
commit 276b221e5bddcdb51370932219add558d1b52e45 1 parent ec834d8
@dgreensp dgreensp authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 packages/jade/package.js
View
20 packages/jade/package.js
@@ -2,3 +2,23 @@ Package.describe({
summary: "Jade template engine"
});
+var jade = require('jade');
+var fs = require('fs');
+
+Package.register_extension(
+ "jade", function(bundle, source_path, serve_path, where) {
+ serve_path = serve_path + '.js';
+
+ var source = fs.readFileSync(source_path, 'utf8');
+
+ var parser = new jade.Parser(source, source_path);
+ var parsed = JSON.stringify(parser.parse());
+
+ bundle.add_resource({
+ type: 'js',
+ path: serve_path,
+ data: new Buffer('J='+parsed+';'),
+ where: where
+ });
+ }
+);
Please sign in to comment.
Something went wrong with that request. Please try again.