-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1df0eb
commit 915eb47
Showing
4 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use strict"; | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var http = require('http'); | ||
var assets = require('./assets.js'); | ||
|
||
function getQuery(path){ | ||
var match = path.match(/=(\w+)/); | ||
return match ? match[1] : null; | ||
} | ||
|
||
module.exports = function(build) { | ||
http.createServer(function(req, res){ | ||
|
||
var src = '/base/mootools-' + build; | ||
var customFunction = getQuery(req.url); | ||
|
||
if (customFunction) return assets[customFunction].call(null, req, res, src); | ||
var filePath = path.join(__dirname, req.url); | ||
fs.readFile(filePath, 'utf-8', function (err, content) { | ||
if (err) return console.log(err); | ||
content = content.replace('mootoolsPath', src); | ||
res.end(content); | ||
}); | ||
}).listen(9000); | ||
} |
This file contains 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