diff --git a/.gitignore b/.gitignore index f6f119a7..bc2b8617 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +nginx.conf.tmp node_modules static_tmp diff --git a/deploy_static b/deploy_static index 8daeb249..3de1ed42 100755 --- a/deploy_static +++ b/deploy_static @@ -25,5 +25,9 @@ ssh $remote sync -f $target ssh $remote ln -snf $target /var/www/html ssh $remote sync . +rsync -rpcv --chmod=D755,F644 --delete nginx.conf.tmp $remote:/etc/nginx/nginx.conf +ssh $remote sync -f /etc/nginx/nginx.conf +ssh $remote systemctl reload nginx + echo echo active is now $target diff --git a/nginx/nginx.conf b/nginx/nginx.conf index cae0ed50..f1ae783c 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -67,7 +67,7 @@ http { map $http_cookie $preload_resources { "~*__Host-preload=1" ""; - default "; rel=preload; as=style, ; rel=preload; as=font; crossorigin, ; rel=preload; as=font; crossorigin, ; rel=preload; as=image"; + default "; rel=preload; as=style, ; rel=preload; as=font; crossorigin, ; rel=preload; as=font; crossorigin, ; rel=preload; as=image"; } server { diff --git a/process_static b/process_static index e0b89c45..d11e030a 100755 --- a/process_static +++ b/process_static @@ -15,6 +15,18 @@ done find static_tmp -name '*.css' -exec csso {} -o {} \; find static_tmp -name '*.js' -exec terser --module -cmo {} {} \; + +replace="" +for file in static_tmp/**/*.css static_tmp/js/*.js; do + hash=$(sha256sum "$file" | head -c 8) + dest="$(dirname $file)/$hash.$(basename $file)" + mv "$file" "$dest" + replace+=";s/\\/$(basename $file)/\\/$(basename $dest)/g" +done + +cp nginx/nginx.conf nginx.conf.tmp +sed -i "$replace" static_tmp/**/*.html nginx.conf.tmp + find static_tmp -name '*.html' -exec html-minifier --collapse-whitespace \ --process-scripts "application/ld+json" --collapse-boolean-attributes \ --remove-attribute-quotes --remove-comments --remove-empty-attributes \ diff --git a/static/404.html b/static/404.html index b755ed62..c4a4b624 100644 --- a/static/404.html +++ b/static/404.html @@ -21,7 +21,7 @@ - + diff --git a/static/articles/grapheneos-servers.html b/static/articles/grapheneos-servers.html index d8e61d9d..08556a42 100644 --- a/static/articles/grapheneos-servers.html +++ b/static/articles/grapheneos-servers.html @@ -23,7 +23,7 @@ - + diff --git a/static/articles/index.html b/static/articles/index.html index f76f377d..aae1eb80 100644 --- a/static/articles/index.html +++ b/static/articles/index.html @@ -23,7 +23,7 @@ - + diff --git a/static/articles/server-traffic-shaping.html b/static/articles/server-traffic-shaping.html index 8ff603b0..0492c807 100644 --- a/static/articles/server-traffic-shaping.html +++ b/static/articles/server-traffic-shaping.html @@ -23,7 +23,7 @@ - + diff --git a/static/articles/sitewide-advertising-industry-opt-out.html b/static/articles/sitewide-advertising-industry-opt-out.html index b8a57026..0161d518 100644 --- a/static/articles/sitewide-advertising-industry-opt-out.html +++ b/static/articles/sitewide-advertising-industry-opt-out.html @@ -23,7 +23,7 @@ - + diff --git a/static/build.html b/static/build.html index 336c8024..f4260f72 100644 --- a/static/build.html +++ b/static/build.html @@ -23,10 +23,10 @@ - + - +