Skip to content

Commit

Permalink
Merge pull request #344 from rubenv/master
Browse files Browse the repository at this point in the history
Encapsulate client-side Jade to make it play nice with RequireJS.
  • Loading branch information
tj committed Dec 28, 2011
2 parents edaa68f + a5fd4b0 commit 157ce18
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions support/compile.js
Expand Up @@ -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';
Expand All @@ -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');
Expand Down

0 comments on commit 157ce18

Please sign in to comment.