1
0
Fork 0
empact/Makefile

56 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2015-03-18 16:23:43 +00:00
JSX = ./node_modules/react-tools/bin/jsx
2015-03-28 16:52:16 +00:00
JSMIN = ./node_modules/uglify-js/bin/uglifyjs
CSSMIN = ./node_modules/clean-css/bin/cleancss
2015-03-17 08:57:45 +00:00
2015-03-08 15:19:28 +00:00
cloc:
2015-03-18 16:23:48 +00:00
cloc . --exclude-dir=node_modules,app/bower_components,app/jsx/build/.module_cache
2015-03-17 08:57:45 +00:00
2015-04-07 11:07:41 +00:00
jsx:
2015-03-18 16:23:43 +00:00
# Compiling JSX
rm -rf app/jsx/build
$(JSX) --extension jsx app/jsx app/jsx/build
2015-04-07 11:07:41 +00:00
js:
2015-03-18 16:23:43 +00:00
# Compressing JS
2015-03-19 13:55:39 +00:00
#
# 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
2015-03-28 16:52:16 +00:00
cat app/app.html \
2015-03-19 13:55:39 +00:00
| 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 \
2015-03-28 16:52:16 +00:00
| $(JSMIN) > build/app.js
2015-03-18 16:23:43 +00:00
2015-04-07 11:07:41 +00:00
css:
2015-03-18 16:23:43 +00:00
# Compressing CSS
2015-03-19 13:55:39 +00:00
#
# Get all style tags
# Ignore local Open Sans stylesheet
# Splitting string by " and taking fourth field (URI)
# Adding "app" prefix
# Concatenation
# Minification
2015-03-28 16:52:16 +00:00
cat app/app.html \
2015-03-19 13:55:39 +00:00
| grep stylesheet \
| grep -v opensans \
| cut -d '"' -f 4 \
| sed -e 's/^/app/' \
| xargs cat \
2015-03-28 16:52:16 +00:00
| $(CSSMIN) -o build/app.css
2015-04-07 11:07:41 +00:00
upload:
scp -r build www@empact.io:~/empact/build
deploy: jsx js css upload