Better dev server integration
This commit is contained in:
13
server/utils/getFileContentType.js
Normal file
13
server/utils/getFileContentType.js
Normal file
@ -0,0 +1,13 @@
|
||||
const mime = require("mime")
|
||||
|
||||
mime.define({
|
||||
"text/plain": ["authors", "changes", "license", "makefile", "patents", "readme", "ts", "flow"]
|
||||
})
|
||||
|
||||
const TextFiles = /\/?(\.[a-z]*rc|\.git[a-z]*|\.[a-z]*ignore)$/i
|
||||
|
||||
function getFileContentType(file) {
|
||||
return TextFiles.test(file) ? "text/plain" : mime.lookup(file)
|
||||
}
|
||||
|
||||
module.exports = getFileContentType
|
Reference in New Issue
Block a user