Move mod content into a separate module
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
export AWS_CONFIG_FILE="$HOME/Documents/CraftingGuide/aws.config"
|
||||
export AWS_CONFIG_FILE="aws.config"
|
||||
|
||||
ROOT="./dist"
|
||||
SITE="crafting-guide.com"
|
||||
@@ -19,7 +19,7 @@ if [[ "$TARGET" == "" ]]; then
|
||||
fi
|
||||
|
||||
if [[ "$TARGET" == "new" ]]; then
|
||||
find "$ROOT" -name ".DS_Store" 2>/dev/null | xargs rm &>/dev/null
|
||||
find . -name ".DS_Store" 2>/dev/null | xargs rm &>/dev/null
|
||||
if grunt dist; then
|
||||
echo "Preparing to upload to S3..."
|
||||
s3cmd sync -r --add-header="cache-control:max-age=1800" "$ROOT/" "s3://new.$SITE/"
|
||||
|
||||
+23
-15
@@ -12,7 +12,20 @@ path = require 'path'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
ROOT = './dist/'
|
||||
ROOT = './dist/'
|
||||
DATA_ROOT = '../crafting-guide-data'
|
||||
|
||||
CONTENT_TYPE = {
|
||||
'.cg': 'text/plain'
|
||||
'.css': 'text/css'
|
||||
'.html': 'text/html'
|
||||
'.js': 'text/javascript'
|
||||
'.json': 'application/json'
|
||||
'.map': 'application/json'
|
||||
'.png': 'image/png'
|
||||
'.ttf': 'application/octet-stream'
|
||||
'.scss': 'text/css'
|
||||
}
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
@@ -29,25 +42,20 @@ serveIndex = (request, response)->
|
||||
response.sendFile '/app.html', root:ROOT
|
||||
console.log ">>> app.html (for #{request.path})"
|
||||
|
||||
app.get '*/$', serveIndex
|
||||
serveData = (request, response)->
|
||||
console.log ">>> #{request.path}"
|
||||
response.set 'Content-Type', CONTENT_TYPE[path.extname request.path]
|
||||
response.sendFile request.path, root:DATA_ROOT
|
||||
|
||||
app.get '/data/*', serveData
|
||||
|
||||
app.get '/craft/*', serveIndex
|
||||
app.get '/login', serveIndex
|
||||
app.get '*/$', serveIndex
|
||||
|
||||
app.get '*', (request, response)->
|
||||
extension = path.extname(request.path)
|
||||
contentType = {
|
||||
'.css': 'text/css'
|
||||
'.html': 'text/html'
|
||||
'.js': 'text/javascript'
|
||||
'.json': 'application/json'
|
||||
'.map': 'application/json'
|
||||
'.png': 'image/png'
|
||||
'.ttf': 'application/octet-stream'
|
||||
'.scss': 'text/css'
|
||||
}[extension]
|
||||
console.log ">>> #{request.path}"
|
||||
|
||||
response.set 'Content-Type', contentType
|
||||
response.set 'Content-Type', CONTENT_TYPE[path.extname request.path]
|
||||
response.sendFile request.path, root:ROOT
|
||||
|
||||
server = app.listen 8000, '127.0.0.1', ->
|
||||
|
||||
Reference in New Issue
Block a user