Browse Source

Restored local js/css processing, removed superfluous .gitignore files, removed htacces-files, moved sample config to sample files

nginx
Markus Pawlata 3 years ago
parent
commit
23900670ca
  1. 6
      .gitignore
  2. 0
      deployment-config.mk.sample
  3. 1
      scanner/.gitignore
  4. 0
      scanner/floatapp/app.cfg.sample
  5. 19
      web/.htaccess
  6. 69
      web/Makefile
  7. BIN
      web/bin/closure-compiler.jar
  8. BIN
      web/bin/yui-compressor.jar
  9. 1
      web/css/.gitignore
  10. 3
      web/css/.htaccess
  11. 12
      web/css/css-minify.sh
  12. 1
      web/js/.gitignore
  13. 3
      web/js/.htaccess
  14. 12
      web/js/js-minify.sh

6
.gitignore

@ -1 +1,7 @@
*.swp
deployment-config.mk
scanner/venv
scanner/floatapp/app.cfg
*.pyc
*.min.css
*.min.js

0
deployment-config.mk → deployment-config.mk.sample

1
scanner/.gitignore

@ -1 +0,0 @@
*.pyc

0
scanner/floatapp/app.cfg → scanner/floatapp/app.cfg.sample

19
web/.htaccess

@ -1,19 +0,0 @@
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/json
<FilesMatch "\.(jpg|otf|ico)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
<FilesMatch "\.(css|js)$">
Header set Cache-Control "max-age=5184000, public"
</FilesMatch>
<FilesMatch "index.html">
Header set Cache-Control "max-age=2678400, public"
</FilesMatch>
<FilesMatch "\.json$">
Header set Cache-Control "max-age=3600, public"
</FilesMatch>
<FilesMatch "Makefile">
deny from all
</FilesMatch>

69
web/Makefile

@ -0,0 +1,69 @@
JS_DIR = js
CSS_DIR = css
JS_MIN = $(JS_DIR)/scripts.min.js
CSS_MIN = $(CSS_DIR)/styles.min.css
JS_MIN_FILES := $(sort $(patsubst %.js, %.min.js, $(filter-out %.min.js, $(wildcard $(JS_DIR)/*.js))))
CSS_MIN_FILES := $(sort $(patsubst %.css, %.min.css, $(filter-out %.min.css, $(wildcard $(CSS_DIR)/*.css))))
JS_COMPILER := java -jar bin/closure-compiler.jar --warning_level QUIET
CSS_COMPILER := java -jar bin/yui-compressor.jar --type css
DEBUG ?= 0
.PHONY: all deploy clean
all: $(JS_MIN) $(CSS_MIN)
ifeq ($(DEBUG),0)
%.min.js: %.js
@echo " JS " $@
@$(JS_COMPILER) --js $< --js_output_file $@
else
%.min.js: %.js
@echo " JS " $@
@cat $< > $@
endif
%.min.css: %.css
@echo " CSS " $@
@$(CSS_COMPILER) -o $@ $<
$(JS_MIN): $(JS_MIN_FILES)
@echo " CAT " $@
@cat $^ > $@
$(CSS_MIN): $(CSS_MIN_FILES)
@echo " CAT " $@
@cat $^ > $@
clean:
@echo " RM " $(JS_MIN) $(JS_MIN_FILES) $(CSS_MIN) $(CSS_MIN_FILES)
@rm -fv $(JS_MIN) $(JS_MIN_FILES) $(CSS_MIN) $(CSS_MIN_FILES)
include ../deployment-config.mk
SSH_OPTS := -q -o ControlMaster=auto -o ControlPath=.ssh-deployment.sock
deploy: all
@echo " SSH $(WEB_SERVER)"
@ssh $(SSH_OPTS) -Nf $(WEB_SERVER)
@echo " RSYNC . $(WEB_SERVER):$(HTDOCS_PATH)"
@ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo -u $(HTDOCS_USER) -v"
@rsync -aizm --delete-excluded --exclude=.ssh-deployment.sock --exclude=Makefile --exclude=*.swp \
--exclude=bin/ --include=scripts.min.js --include=styles.min.css \
--exclude=*.js --exclude=*.css --rsh="ssh $(SSH_OPTS)" \
--rsync-path="sudo -n -u $(HTDOCS_USER) rsync" \
. "$(WEB_SERVER):$(HTDOCS_PATH)"
@echo " CHOWN $(HTDOCS_USER):$(HTDOCS_USER) $(WEB_SERVER):$(HTDOCS_PATH)"
@ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo chown -R $(HTDOCS_USER):$(HTDOCS_USER) '$(HTDOCS_PATH)'"
@echo " CHMOD 750/640 $(WEB_SERVER):$(HTDOCS_PATH)"
@ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo find '$(HTDOCS_PATH)' -type f -exec chmod 640 {} \;; \
sudo find '$(HTDOCS_PATH)' -type d -exec chmod 750 {} \;;"
@echo " SSH $(WEB_SERVER)"
@ssh -O exit $(SSH_OPTS) $(WEB_SERVER)

BIN
web/bin/closure-compiler.jar

BIN
web/bin/yui-compressor.jar

1
web/css/.gitignore

@ -1 +0,0 @@
*.min.css

3
web/css/.htaccess

@ -1,3 +0,0 @@
<FilesMatch "(?<!min)\.css">
deny from all
</FilesMatch>

12
web/css/css-minify.sh

@ -1,12 +0,0 @@
#!/bin/bash
# minify all .css-files
ls -1 *.css|grep -Ev "min.css$" | while read cssfile; do
newfile="${cssfile%.*}.min.css"
echo "$cssfile --> $newfile"
curl -X POST -s --data-urlencode "input@$cssfile" http://cssminifier.com/raw > $newfile
done
# merge all into one single file
rm -f styles.min.css
cat *.min.css > styles.min.css

1
web/js/.gitignore

@ -1 +0,0 @@
*.min.js

3
web/js/.htaccess

@ -1,3 +0,0 @@
<FilesMatch "(?<!min)\.js">
deny from all
</FilesMatch>

12
web/js/js-minify.sh

@ -1,12 +0,0 @@
#!/bin/bash
# minify all .js-files
ls -1 *.js|grep -Ev "min.js$" | while read jsfile; do
newfile="${jsfile%.*}.min.js"
echo "$jsfile --> $newfile"
curl -X POST -s --data-urlencode "input@$jsfile" http://javascript-minifier.com/raw > $newfile
done
# merge all into one single file
rm -f scripts.min.js
cat *.min.js > scripts.min.js
Loading…
Cancel
Save