Merge pull request #470 from prometheus/beorn7/slim-static-assets

Slim down the files we embed into the binary.
This commit is contained in:
Björn Rabenstein 2015-01-26 15:24:15 +01:00
commit 855f20a4d3
5 changed files with 8 additions and 8 deletions

View file

@ -2,7 +2,7 @@
{{/* Load Prometheus console library JS/CSS. Should go in <head> */}} {{/* Load Prometheus console library JS/CSS. Should go in <head> */}}
{{ define "prom_console_head" }} {{ define "prom_console_head" }}
<link type="text/css" rel="stylesheet" href="/static/vendor/rickshaw/rickshaw.min.css"> <link type="text/css" rel="stylesheet" href="/static/vendor/rickshaw/rickshaw.min.css">
<link type="text/css" rel="stylesheet" href="/static/vendor/bootstrap-3.3.1/css/bootstrap.css"> <link type="text/css" rel="stylesheet" href="/static/vendor/bootstrap-3.3.1/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="/static/css/prom_console.css"> <link type="text/css" rel="stylesheet" href="/static/css/prom_console.css">
<script src="/static/vendor/rickshaw/vendor/d3.min.js"></script> <script src="/static/vendor/rickshaw/vendor/d3.min.js"></script>
<script src="/static/vendor/rickshaw/vendor/d3.layout.min.js"></script> <script src="/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>

View file

@ -14,7 +14,8 @@ do
cd "${dir}" cd "${dir}"
echo "\"$(basename ${dir})\": {" echo "\"$(basename ${dir})\": {"
find . -type f | while read file # Do not embed map files and the non-minified bootstrap files.
find . -type f \! -name \*.map \! -name bootstrap.js \! -name bootstrap-theme.css \! -name bootstrap.css | while read file
do do
name=$(echo "${file}"|sed 's|\.\/||') name=$(echo "${file}"|sed 's|\.\/||')
echo "\"$name\": {" echo "\"$name\": {"

View file

@ -11,14 +11,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
all: blob-stamp all: blob
blob-stamp: templates/* blob:
$(MAKE) -C blob $(MAKE) -C blob
touch $@
clean: clean:
$(MAKE) -C blob clean $(MAKE) -C blob clean
-rm -f *-stamp
.PHONY: clean .PHONY: clean blob

View file

@ -17,6 +17,7 @@ all: files.go
SUFFIXES: SUFFIXES:
# Do not embed map files and the non-minified bootstrap files.
files.go: $(shell find ../templates/ ../static/ -type f) files.go: $(shell find ../templates/ ../static/ -type f)
../../utility/embed-static.sh ../static ../templates | $(GOFMT) > $@ ../../utility/embed-static.sh ../static ../templates | $(GOFMT) > $@

View file

@ -5,7 +5,7 @@
<title>Prometheus Time Series Collection and Processing Server</title> <title>Prometheus Time Series Collection and Processing Server</title>
<script src="/static/vendor/js/jquery.min.js"></script> <script src="/static/vendor/js/jquery.min.js"></script>
<link type="text/css" rel="stylesheet" href="/static/vendor/bootstrap-3.3.1/css/bootstrap.css"> <link type="text/css" rel="stylesheet" href="/static/vendor/bootstrap-3.3.1/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="/static/css/prometheus.css"> <link type="text/css" rel="stylesheet" href="/static/css/prometheus.css">
{{template "head" .}} {{template "head" .}}