Skip to content

Instantly share code, notes, and snippets.

@oroce
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save oroce/a10a8173f4dbe2fbbe9f to your computer and use it in GitHub Desktop.

Select an option

Save oroce/a10a8173f4dbe2fbbe9f to your computer and use it in GitHub Desktop.
var fs = require('fs');
var jade = require('jade');
require.extensions['.jade'] = function(module, data) {
var content = fs.readFileSync(module.filename);
var str = 'module.exports = ' + jade.compile(content, {filename: module.filename});
console.log(module.filename, str);
return module._compile(str, data);
};
@ruffle1986
Copy link

When you use relative paths in you jade templates, you have to set 'filename' option property.

@ruffle1986
Copy link

And the function above is not going to get a string but an object that has a filename property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment