ForbesLindesay / browserify-middleware

express middleware for browserify, done right
http://browserify.org
MIT License
381 stars 66 forks source link

Serving directories with transformations #53

Closed ysulyma closed 10 years ago

ysulyma commented 10 years ago

I use browserify-middleware in conjunction with the liveify transformation to serve browserify LiveScript files. For individual files this works fine; however, when serving directories it is broken. My setup is as follows:

var browserify = require('browserify-middleware')

browserify.settings('grep', /\.[jl]s$/)
app.use(
  "/js",
  browserify(
    __dirname + "public/ls/",
    {transform: ['liveify']}
  )
)

Then for example I would like /js/effects.js to compile public/ls/effects.ls into JavaScript, and then run browserify on the result. However, the browserify directory middleware is written in such a way that I need the URL to be /js/effects.ls in order for this work.

ForbesLindesay commented 10 years ago

That's not how the folder serving works. You have to request /js/effects.ls which will work fine because the browser looks at the mime type, not the file extension.