Update build script and nginx config

This commit is contained in:
2015-03-28 23:52:16 +07:00
parent 86fbe67ec9
commit 71f5781c86
5 changed files with 28 additions and 26 deletions
+7 -19
View File
@@ -1,13 +1,12 @@
JSX = ./node_modules/react-tools/bin/jsx
UGLIFY = ./node_modules/uglify-js/bin/uglifyjs
CLEANCSS = ./node_modules/clean-css/bin/cleancss
JSMIN = ./node_modules/uglify-js/bin/uglifyjs
CSSMIN = ./node_modules/clean-css/bin/cleancss
cloc:
cloc . --exclude-dir=node_modules,app/bower_components,app/jsx/build/.module_cache
dist:
# Compiling JSX
mkdir -p build
rm -rf app/jsx/build
$(JSX) --extension jsx app/jsx app/jsx/build
@@ -20,7 +19,7 @@ dist:
# Prepending dependencies to the list
# Concatenation
# Minification
cat app/index.html \
cat app/app.html \
| grep script \
| grep -v bower \
| cut -d '"' -f 2 \
@@ -30,7 +29,7 @@ dist:
echo app/bower_components/lodash/lodash.min.js && \
cat ) \
| xargs cat \
| $(UGLIFY) > build/app.js
| $(JSMIN) > build/app.js
# Compressing CSS
#
@@ -40,22 +39,11 @@ dist:
# Adding "app" prefix
# Concatenation
# Minification
cat app/index.html \
cat app/app.html \
| grep stylesheet \
| grep -v fonts.googleapis.com \
| grep -v opensans \
| cut -d '"' -f 4 \
| sed -e 's/^/app/' \
| xargs cat \
| $(CLEANCSS) -o build/app.css
# Replacing all link tags with a single one
# Replacing all script tags with a single one
cat app/index.html \
| perl -pe 's/<link.*>\n/STYLE_TAG/g' \
| perl -pe 's/(STYLE_TAG\s*)+/\
<link rel="stylesheet" href="\/app.css">\n \
<link rel="stylesheet" href="\/\/fonts.googleapis.com\/css?family=Open\+Sans:400,600">\n /g' \
| perl -pe 's/<script.*>\n/SCRIPT_TAG/g' \
| perl -pe 's/(SCRIPT_TAG\s*)+/\
<script type="text\/javascript" src="\/app.js"><\/script>\n/g' \
> build/index.html
| $(CSSMIN) -o build/app.css