runk / connect-jade-static

Connect (ExpressJS) middleware for serving jade files as static html
8 stars 6 forks source link

Replace regexp function with basic string operation #7

Open thecatontheflat opened 9 years ago

thecatontheflat commented 9 years ago

https://github.com/runk/connect-jade-static/blob/master/index.js#L54

I think it would make sense to perform a simple string operation here:

var urlpath = parsed.pathname.replace(/html$/, 'jade').replace(opts.baseUrl, '');

As far as I understood - the logic is to replace the string from the end. It can be achieved in more efficient ways :) I'll create a PR later

runk commented 9 years ago

Sure, all improvements are welcome :+1:

thecatontheflat commented 9 years ago

I've updated my PR https://github.com/runk/connect-jade-static/pull/6