Permalink
Browse files

Merge pull request #344 from rubenv/master

Encapsulate client-side Jade to make it play nice with RequireJS.
  • Loading branch information...
2 parents edaa68f + a5fd4b0 commit 157ce18ca3e483d757d671954e01c16b03b37a01 @tj tj committed Dec 28, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 support/compile.js
View
@@ -88,6 +88,7 @@ function parseConditionals(js) {
function compile() {
var buf = '';
+ buf += '(function() {\n';
buf += '\n// CommonJS require()\n\n';
buf += browser.require + '\n\n';
buf += 'require.modules = {};\n\n';
@@ -101,6 +102,8 @@ function compile() {
buf += js;
buf += '\n}); // module: ' + file + '\n';
});
+ buf += '\nwindow.jade = require("jade");\n';
+ buf += '})();\n';
fs.writeFile('jade.js', buf, function(err){
if (err) throw err;
console.log(' \033[90m create : \033[0m\033[36m%s\033[0m', 'jade.js');

0 comments on commit 157ce18

Please sign in to comment.