visionmedia/express — Issue #960: Static javascript library files in template not served using mustache view engine
Author: jzabel
Created: 2012-01-11 22:50:56+00:00
State: open

Hi,

I am new to express, but this seems to be an issue in the source of the static routing component. I have changed the template engine to use mustasche. My configuration looks like this:

// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
// app.set('view engine', 'jade');
app.set('view engine', 'mustache');
app.register('.mustache', require('stache'));
app.use(express.bodyParser(
{uploadDir: __dirname + '/uploads'}
));
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({ secret: 'your secret here' }));
app.use(app.router);
app.use(express.static(__dirname + '/public'));
app.use(form({ keepExtensions: true })); //Use connect-form for file uploads
});

When I try to load a javascript file server from public/js, it is unable to load the file. It seems it may be trying to process this file? I do not have the same problems for css files and this only occurs with libraries i have downloaded locally (my custom javascript files load with no problem). Debugging to me, it seems it is looking for an end of file and waiting for this?

To reproduce - try to load something like Jquery in your template locally rather than from the CDN as follows:

In the layout.mustache

{{title}}

{{{yield}}}

in the view.mustache

Page will not load until 2 min when script load times out

Please let me know if you need more information to reproduce. Any tips or help would be greatly appreciated!

Thanks!