I've successfully created a JavaScript file using a Jade template with the help of browserify, browserify-middleware, and jadeify on the server side in Node. The only thing required to generate the JavaScript file is:
app.use('/templates', require('browserify-middleware')('./public-includes'),
{
grep: /\.jade$/,
transform: ['jadeify']
}));
Now, when I try to access the generated JavaScript code from /templates/template.jade
in the web browser (I have provided an example here), I can see that it sets various functions on module.exports similar to what we do in Node. However, my challenge lies in using this on the client side. I attempted to use require.js like so -
var template = require('/templates/template.jade', function(template){});
, but it returned undefined.
Do I need to utilize browserify on the client-side as well? Most examples discuss bundles, but since I run it on a directory without specifying a bundle name, I'm unsure if the same principles apply.