Build script
This commit is contained in:
parent
e2ad2739cd
commit
3c1b27b1bf
48
Makefile
48
Makefile
|
@ -1,19 +1,43 @@
|
||||||
|
JSX = ./node_modules/react-tools/bin/jsx
|
||||||
UGLIFY = ./node_modules/uglify-js/bin/uglifyjs
|
UGLIFY = ./node_modules/uglify-js/bin/uglifyjs
|
||||||
CLEANCSS = ./node_modules/clean-css/bin/cleancss
|
CLEANCSS = ./node_modules/clean-css/bin/cleancss
|
||||||
|
|
||||||
cloc:
|
cloc:
|
||||||
cloc . --exclude-dir=app/bower_components,app/scripts/.module-cache
|
cloc . --exclude-dir=app/bower_components,app/scripts/.module-cache
|
||||||
|
|
||||||
static:
|
dist:
|
||||||
$(UGLIFY) \
|
# Compiling JSX
|
||||||
app/bower_components/react/react.min.js \
|
mkdir -p build
|
||||||
app/bower_components/react-router/build/global/ReactRouter.min.js \
|
rm -rf app/jsx/build
|
||||||
app/bower_components/lodash/lodash.min.js \
|
$(JSX) --extension jsx app/jsx app/jsx/build
|
||||||
app/js/* \
|
|
||||||
app/jsx/build/charts/* \
|
# Compressing JS
|
||||||
app/jsx/build/app.js \
|
cat app/index.html \
|
||||||
> build/app.js
|
| grep script \
|
||||||
cat \
|
| grep -v bower \
|
||||||
app/bower_components/normalize.css/normalize.css \
|
| cut -d '"' -f 2 \
|
||||||
app/css/* \
|
| 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
|
||||||
|
cat app/index.html \
|
||||||
|
| grep stylesheet \
|
||||||
|
| grep -v http \
|
||||||
|
| cut -d '"' -f 4 \
|
||||||
|
| sed -e 's/^/app/' \
|
||||||
|
| xargs cat \
|
||||||
| $(CLEANCSS) -o build/app.css
|
| $(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 /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
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<link rel="stylesheet" href="/css/menu.css">
|
<link rel="stylesheet" href="/css/menu.css">
|
||||||
<link rel="stylesheet" href="/css/app.css">
|
<link rel="stylesheet" href="/css/app.css">
|
||||||
<link rel="stylesheet" href="/css/charts.css">
|
<link rel="stylesheet" href="/css/charts.css">
|
||||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'>
|
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600">
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body></body>
|
||||||
<script src="/bower_components/react/react.js"></script>
|
<script src="/bower_components/react/react.js"></script>
|
||||||
|
|
|
@ -3,14 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf8">
|
<meta charset="utf8">
|
||||||
<title>Empact</title>
|
<title>Empact</title>
|
||||||
<link rel="shortcut icon" sizes="16x16 32x32 64x64" href="/images/favicon.ico">
|
|
||||||
<link rel="apple-touch-icon" sizes="57x57" href="/images/favicon_128.png">
|
|
||||||
<link rel="apple-touch-icon" sizes="114x114" href="/images/favicon_128.png">
|
|
||||||
<link rel="apple-touch-icon" sizes="72x72" href="/images/favicon_128.png">
|
|
||||||
<link rel="apple-touch-icon" sizes="144x144" href="/images/favicon_128.png">
|
|
||||||
<link rel="stylesheet" href="/app.css">
|
<link rel="stylesheet" href="/app.css">
|
||||||
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600">
|
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body></body>
|
||||||
<script src="/app.js"></script>
|
<script type="text/javascript" src="/app.js"></script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"name": "empact",
|
"name": "empact",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"react-tools": "0.12.2",
|
||||||
"uglify-js": "2.4.17",
|
"uglify-js": "2.4.17",
|
||||||
"clean-css": "3.1.7"
|
"clean-css": "3.1.7"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue