Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added minifying tool and some scripts to help with development.
- Loading branch information
Showing
23 changed files
with
231 additions
and
40 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
# Folders | ||
_obj | ||
_test | ||
prod | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
|
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 @@ | ||
prod.yaml |
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,65 @@ | ||
#!/bin/bash | ||
|
||
# Delete any files in prod | ||
if [ -d "prod" ]; then | ||
rm -rf "prod" | ||
fi | ||
|
||
# Make the prod diretory if it doesn't exist. | ||
[ ! -d "prod" ] && mkdir prod | ||
|
||
# Use the closure tool to build all.min.js | ||
closure \ | ||
`find dev -name "*.js" | xargs -n1 echo -n ' --js'` \ | ||
--compilation_level SIMPLE_OPTIMIZATIONS \ | ||
--warning_level QUIET \ | ||
--js_output_file prod/all.min.js | ||
|
||
# Use yuicompressor to minify css. | ||
find dev -name "*.css" | xargs cat | \ | ||
yuicompressor \ | ||
--type css >prod/all.min.css | ||
|
||
# Write out the view files as templates within the HTML page. | ||
css=false | ||
css_out=false | ||
js=false | ||
js_out=false | ||
cat dev/index.html | while read LINE; do | ||
case "$LINE" in | ||
*\<!--\ APP\ CSS\ --\>*) | ||
if ! $css_out; then | ||
echo -n '<link rel="stylesheet" href="/all.min.css">' | ||
css_out=true | ||
fi | ||
if $css; then css=false; else css=true; fi | ||
;; | ||
*\<!--\ APP\ JS\ --\>*) | ||
if ! $js_out; then | ||
echo -n '<script src="/all.min.js"></script>' | ||
js_out=true | ||
fi | ||
if $js; then js=false; else js=true; fi | ||
;; | ||
*\<!--\ EMBED\ HERE\ --\>*) | ||
for FILE in `find dev -name "*.html" -not -name "index.html"`; do | ||
BFILE=`basename $FILE` | ||
echo -n "<script type=\"text/ng-template\" id=\"$BFILE\">" | ||
htmlcompressor $FILE | ||
echo -n "</script>" | ||
done | ||
;; | ||
|
||
*) | ||
if $js; then continue; fi | ||
if $css; then continue; fi | ||
echo "$LINE" | ||
;; | ||
esac | ||
done | htmlcompressor > prod/index.html | ||
|
||
# Save favicon if it exists. | ||
[ -f "dev/favicon.ico" ] && cp -af dev/favicon.ico prod | ||
|
||
# We need to copy the img dir over. | ||
[ -d "dev/img" ] && cp -af dev/img prod/img |
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,36 @@ | ||
application: lists-themarshians-com | ||
version: 1 | ||
runtime: go | ||
api_version: go1 | ||
|
||
handlers: | ||
- url: /rest/.* | ||
script: _go_app | ||
login: required | ||
auth_fail_action: unauthorized | ||
|
||
- url: / | ||
static_files: dev/index.html | ||
upload: dev/index.html | ||
login: required | ||
mime_type: text/html; charset=utf-8 | ||
|
||
- url: /(.*\.css) | ||
mime_type: text/css; charset=utf-8 | ||
static_files: dev/\1 | ||
upload: dev/(.*\.css) | ||
|
||
- url: /(.*\.html) | ||
mime_type: text/html; charset=utf-8 | ||
static_files: dev/\1 | ||
upload: dev/(.*\.html) | ||
|
||
- url: /(.*\.ico) | ||
mime_type: image/x-icon; charset=utf-8 | ||
static_files: dev/\1 | ||
upload: dev/(.*\.ico) | ||
|
||
- url: /(.*\.js) | ||
mime_type: text/javascript; charset=utf-8 | ||
static_files: dev/\1 | ||
upload: dev/(.*\.js) |
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,64 @@ | ||
#!/bin/bash | ||
|
||
# Delete any files in prod | ||
if [ -d "prod" ]; then | ||
rm -rf "prod" | ||
fi | ||
|
||
# Make the prod diretory if it doesn't exist. | ||
[ ! -d "prod" ] && mkdir prod | ||
|
||
# Use the closure tool to build all.min.js | ||
closure \ | ||
`find public -name "*.js" | xargs -n1 echo -n ' --js'` \ | ||
--compilation_level SIMPLE_OPTIMIZATIONS \ | ||
--warning_level QUIET \ | ||
--js_output_file prod/all.js | ||
|
||
# Use yuicompressor to minify css. | ||
find public -name "*.css" | xargs cat | \ | ||
yuicompressor \ | ||
--type css >prod/all.css | ||
|
||
# Write out the view files as templates within the HTML page. | ||
css=false | ||
css_out=false | ||
js=false | ||
js_out=false | ||
cat public/index.html | while read LINE; do | ||
case "$LINE" in | ||
*\<!--\ APP\ CSS\ --\>*) | ||
if ! $css_out; then | ||
echo -n '<link rel="stylesheet" href="/all.min.css">' | ||
css_out=true | ||
fi | ||
if $css; then css=false; else css=true; fi | ||
;; | ||
*\<!--\ APP\ JS\ --\>*) | ||
if ! $js_out; then | ||
echo -n '<script src="/all.min.js"></script>' | ||
js_out=true | ||
fi | ||
if $js; then js=false; else js=true; fi | ||
;; | ||
*\<!--\ EMBED\ HERE\ --\>*) | ||
for FILE in `find public -name "*.html" -not -name "index.html"`; do | ||
echo -n "<script type=\"text/ng-template\" id=\"$FILE\">" | ||
htmlcompressor $FILE | ||
echo -n "</script>" | ||
done | ||
;; | ||
|
||
*) | ||
if $js; then continue; fi | ||
if $css; then continue; fi | ||
echo "$LINE" | ||
;; | ||
esac | ||
done | htmlcompressor > prod/index.html | ||
|
||
# Save favicon if it exists. | ||
[ -f "public/favicon.ico" ] && cp -af public/favicon.ico prod | ||
|
||
# We need to copy the img dir over. | ||
[ -d "public/img" ] && cp -af public/img prod/img |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,5 @@ | ||
#!/bin/bash | ||
|
||
IPADDR=`ip addr | grep -o "10\.84\.7\.[0-9]*" | head -n1` | ||
|
||
$APPENGINE_SDK/dev_appserver.py --use_sqlite --high_replication -a $IPADDR $@ |
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,36 @@ | ||
application: lists-themarshians-com | ||
version: 1 | ||
runtime: go | ||
api_version: go1 | ||
|
||
handlers: | ||
- url: /rest/.* | ||
script: _go_app | ||
login: required | ||
auth_fail_action: unauthorized | ||
|
||
- url: / | ||
static_files: prod/index.html | ||
upload: prod/index.html | ||
login: required | ||
mime_type: text/html; charset=utf-8 | ||
|
||
- url: /(.*\.css) | ||
mime_type: text/css; charset=utf-8 | ||
static_files: prod/\1 | ||
upload: prod/(.*\.css) | ||
|
||
- url: /(.*\.html) | ||
mime_type: text/html; charset=utf-8 | ||
static_files: prod/\1 | ||
upload: prod/(.*\.html) | ||
|
||
- url: /(.*\.ico) | ||
mime_type: image/x-icon; charset=utf-8 | ||
static_files: prod/\1 | ||
upload: prod/(.*\.ico) | ||
|
||
- url: /(.*\.js) | ||
mime_type: text/javascript; charset=utf-8 | ||
static_files: prod/\1 | ||
upload: prod/(.*\.js) |
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,5 @@ | ||
#!/bin/bash | ||
|
||
./yprod | ||
|
||
$APPENGINE_SDK/appcfg.py $@ |
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,4 @@ | ||
#!/bin/bash | ||
|
||
[ -h app.yaml ] && unlink app.yaml | ||
ln -s dev.yaml app.yaml |
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,4 @@ | ||
#!/bin/bash | ||
|
||
[ -h app.yaml ] && unlink app.yaml | ||
ln -s prod.yaml app.yaml |