Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Define use of jade templating language
- */
- require.extensions['.jade'] = function (module, filename) {
- var content = fs.readFileSync(filename, 'utf8');
- var name = path.basename(filename).replace(/\..+$/, '');
- try {
- // Replace this with whatever your template engine requires to compile
- // templates. Be sure to assign the function to module.exports
- module.exports = jade.compile(content, {});
- Bones.plugin.add(module.exports, filename);
- } catch (err) {
- // Show error message when template compilation failed.
- var lines = err.message.split('\n');
- lines.splice(1, 0, ' in template ' + filename);
- err.message = lines.join('\n');
- throw err;
- }
- // The .register() method is called when the template is added to a server
- module.exports.register = function (app) {
- if (app.assets) {
- app.assets.templates.push({
- filename: filename,
- // Replace this with whatever you want to send to the client.
- content: 'template = ' + jade.compile(content, { client: true, compileDebug: false } ) + ';'
- });
- }
- };
- };
Add Comment
Please, Sign In to add comment