Commit 6e6684a5 by Andrew Nesbitt

Merge pull request #171 from Fetz/prefix-fix

add prefix to options to remove from path
parents 682dee1a 79c1965d
...@@ -92,8 +92,9 @@ var server = connect.createServer( ...@@ -92,8 +92,9 @@ var server = connect.createServer(
, dest: __dirname + '/public' , dest: __dirname + '/public'
, debug: true , debug: true
, outputStyle: 'compressed' , outputStyle: 'compressed'
, prefix: '/prefix'
}), }),
connect.static(__dirname + '/public') connect.static('/prefix', __dirname + '/public')
); );
``` ```
......
...@@ -75,6 +75,9 @@ module.exports = function(options){ ...@@ -75,6 +75,9 @@ module.exports = function(options){
return function sass(req, res, next){ return function sass(req, res, next){
if ('GET' != req.method && 'HEAD' != req.method) return next(); if ('GET' != req.method && 'HEAD' != req.method) return next();
var path = url.parse(req.url).pathname; 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)) { if (/\.css$/.test(path)) {
var cssPath = join(dest, path) var cssPath = join(dest, path)
, sassPath = join(src, path.replace('.css', '.scss')) , sassPath = join(src, path.replace('.css', '.scss'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment