Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #171 from Fetz/prefix-fix
Browse files Browse the repository at this point in the history
add prefix to options to remove from path
  • Loading branch information
andrew committed Oct 19, 2013
2 parents 682dee1 + 79c1965 commit 6e6684a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ var server = connect.createServer(
, dest: __dirname + '/public'
, debug: true
, outputStyle: 'compressed'
, prefix: '/prefix'
}),
connect.static(__dirname + '/public')
connect.static('/prefix', __dirname + '/public')
);
```
Expand Down
3 changes: 3 additions & 0 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ module.exports = function(options){
return function sass(req, res, next){
if ('GET' != req.method && 'HEAD' != req.method) return next();
var path = url.parse(req.url).pathname;
if (options.prefix && 0 === path.indexOf(options.prefix)) {
path = path.substring(options.prefix.length);
}
if (/\.css$/.test(path)) {
var cssPath = join(dest, path)
, sassPath = join(src, path.replace('.css', '.scss'))
Expand Down

0 comments on commit 6e6684a

Please sign in to comment.