Add webpack #1
16
Makefile
16
Makefile
@ -28,20 +28,12 @@ clean:
|
||||
rm -f ./bindata.go
|
||||
|
||||
bindata.go: client client/*
|
||||
rm -fr ./clientpack
|
||||
cp -r ./client ./clientpack
|
||||
( echo ';(function() {' ; cat clientpack/dcwebui.js ; echo '})();' ) | uglifyjs -o clientpack/dcwebui.min.js -c -m --ie8
|
||||
lessc --clean-css clientpack/dcwebui.css clientpack/dcwebui.min.css
|
||||
cat clientpack/index.htm \
|
||||
| sed -e '/dcwebui.css/{i <style>' -e 'r clientpack/dcwebui.min.css' -e 'a </style>' -e 'd}' \
|
||||
| sed -e '/dcwebui.js/{i <script>' -e 'r clientpack/dcwebui.min.js' -e 'a </script>' -e 'd}' \
|
||||
| sed -e '/socket.io-1.7.2.js/{i <script>' -e 'r clientpack/socket.io-1.7.2.js' -e 'a </script>' -e 'd}' \
|
||||
> clientpack/index.packed.htm
|
||||
mv clientpack/index.packed.htm clientpack/index.htm
|
||||
npm run webpack
|
||||
cat client/index.htm \
|
||||
| sed -e '/bundle.js/{i <script>' -e 'r clientpack/bundle.min.js' -e 'a </script>' -e 'd}' \
|
||||
> clientpack/index.htm
|
||||
html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm
|
||||
mv clientpack/index.min.htm clientpack/index.htm
|
||||
rm ./clientpack/*.js
|
||||
rm ./clientpack/*.css
|
||||
go-bindata -nomemcopy -nometadata -prefix clientpack clientpack
|
||||
|
||||
$(BINNAME).exe: bindata.go *.go
|
||||
|
@ -4,7 +4,7 @@
|
||||
"description": "",
|
||||
"main": "s",
|
||||
"scripts": {
|
||||
"build": "webpack && cp client/index.htm clientpack"
|
||||
"webpack": "webpack"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Loading…
Reference in New Issue
Block a user