1
0
Fork 0

Precompile JSX, build with make

This commit is contained in:
Gregory Eremin 2015-02-08 21:21:25 +07:00
parent 54b1aa9c56
commit 6563736fae
3 changed files with 22 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
burlesque
*.rice-box.go
.module-cache
server/static/app.js

17
Makefile Normal file
View File

@ -0,0 +1,17 @@
all: jsx cleanup embed build
check-react:
@type jsx >/dev/null 2>&1 || (echo "Please install React.js toolkit:\nnpm install -g react-tools\n" && exit 1)
jsx: check-react
jsx --extension jsx server/static/ server/static/
rm -rf server/static/.module-cache
cleanup:
find . -name '.DS_Store' | xargs rm -f
embed:
rice -i ./server embed-go
build:
go build

View File

@ -6,15 +6,14 @@
<meta charset="utf8">
<link rel="stylesheet" href="/static/app.css">
<script src="http://fb.me/react-0.12.2.js"></script>
<script src="http://fb.me/JSXTransformer-0.12.2.js"></script>
<script src="/static/app.js"></script>
</head>
<body>
<h1 class="heading">Burlesque v{{.version}} at {{.hostname}}</h1>
<div id="dashboard"></div>
<script type="text/jsx" src="/static/app.jsx"></script>
<script type="text/jsx">
<script>
React.render(
<Dashboard api="http://127.0.0.1:{{.port}}/status" interval={1000} />,
React.createElement(Dashboard, {api: "http://127.0.0.1:{{.port}}/status", interval: 1000}),
document.getElementById('dashboard')
);
</script>