Makefile comments and formatting
This commit is contained in:
parent
46cf7f600b
commit
4c2fb60652
60
Makefile
60
Makefile
|
@ -12,32 +12,50 @@ dist:
|
|||
$(JSX) --extension jsx app/jsx app/jsx/build
|
||||
|
||||
# Compressing JS
|
||||
#
|
||||
# Get all script tags
|
||||
# Ignore Bower deps, include minified versions later
|
||||
# Splitting string by " and taking second field (URI)
|
||||
# Adding "app" prefix
|
||||
# Prepending dependencies to the list
|
||||
# Concatenation
|
||||
# Minification
|
||||
cat app/index.html \
|
||||
| grep script \
|
||||
| grep -v bower \
|
||||
| cut -d '"' -f 2 \
|
||||
| sed -e 's/^/app/' \
|
||||
| ( echo app/bower_components/react/react.min.js && \
|
||||
echo app/bower_components/react-router/build/global/ReactRouter.min.js && \
|
||||
echo app/bower_components/lodash/lodash.min.js && \
|
||||
cat ) \
|
||||
| xargs cat \
|
||||
| $(UGLIFY) > build/app.js
|
||||
| grep script \
|
||||
| grep -v bower \
|
||||
| cut -d '"' -f 2 \
|
||||
| sed -e 's/^/app/' \
|
||||
| ( echo app/bower_components/react/react.min.js && \
|
||||
echo app/bower_components/react-router/build/global/ReactRouter.min.js && \
|
||||
echo app/bower_components/lodash/lodash.min.js && \
|
||||
cat ) \
|
||||
| xargs cat \
|
||||
| $(UGLIFY) > build/app.js
|
||||
|
||||
# Compressing CSS
|
||||
#
|
||||
# Get all style tags
|
||||
# Ignore local Open Sans stylesheet
|
||||
# Splitting string by " and taking fourth field (URI)
|
||||
# Adding "app" prefix
|
||||
# Concatenation
|
||||
# Minification
|
||||
cat app/index.html \
|
||||
| grep stylesheet \
|
||||
| grep -v opensans \
|
||||
| cut -d '"' -f 4 \
|
||||
| sed -e 's/^/app/' \
|
||||
| xargs cat \
|
||||
| $(CLEANCSS) -o build/app.css
|
||||
| grep stylesheet \
|
||||
| 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="http:\/\/fonts.googleapis.com\/css?family=Open\+Sans:400,300,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
|
||||
| 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,300,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
|
||||
|
|
Loading…
Reference in New Issue