Stylesheets done
This commit is contained in:
1 parent
0489e2e047
commit
74f1c7d27b
2 files changed
+104
-144
No files matched your search
@@ -5,7 +5,8 @@ exports.newFoundationsUtilitiesHttpResponses = function () {
|
||||
respondWithContent: respondWithContent,
|
||||
respondWithImage: respondWithImage,
|
||||
respondWithFont: respondWithFont,
|
||||
respondWithEmptyArray: respondWithEmptyArray
|
||||
respondWithEmptyArray: respondWithEmptyArray,
|
||||
respondWithStyleSheet: respondWithStyleSheet
|
||||
}
|
||||
|
||||
return thisObject
|
||||
@@ -109,4 +110,20 @@ exports.newFoundationsUtilitiesHttpResponses = function () {
|
||||
httpResponse.write('[]')
|
||||
httpResponse.end('\n')
|
||||
}
|
||||
|
||||
function respondWithStyleSheet(httpResponse, path, fileName) {
|
||||
let fs = SA.nodeModules.fs
|
||||
let filePath = path + 'WebServer/css/' + fileName
|
||||
fs.readFile(filePath, onFileRead)
|
||||
|
||||
function onFileRead(err, file) {
|
||||
try {
|
||||
let fileContent = file.toString()
|
||||
|
||||
SA.projects.foundations.utilities.httpResponses.respondWithContent(fileContent, httpResponse, 'text/css')
|
||||
} catch (err) {
|
||||
console.log('[ERROR] respondWithStyleSheet -> File Not Found: ' + fileName + ' or Error = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user