Created
April 1, 2014 08:56
-
-
Save xiaojue/9910473 to your computer and use it in GitHub Desktop.
css.node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var combine = addModule('css-combine'); | |
var u = require('url'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var qs = require('querystring'); | |
logger.log(123); | |
route(function(req,res){ | |
var file = decodeURIComponent(qs.parse(u.parse(req.url).query).file) + '.css'; | |
file = path.resolve(__dirname,file); | |
if(fs.existsSync(file)){ | |
res.writeHeader(200,{ | |
'content-type':'text/css' | |
}); | |
combine(file).pipe(res); | |
}else{ | |
res.writeHeader(404,'text/html'); | |
res.end('404'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment