Build system

This commit is contained in:
mathias 2018-04-02 23:12:19 +02:00
parent 95a1cb0fa5
commit 98898a7572
2 changed files with 75 additions and 22 deletions

View file

@ -1,5 +1,8 @@
RewriteBase /
RewriteEngine On
AddDefaultCharset utf-8
AddCharset UTF-8 .css .js
AddCharset UTF-8 .css .js .webmanifest
FileETag MTime Size
ServerSignature Off
SetEnvIf Host ^ suppress-error-charset
@ -7,8 +10,18 @@ SetEnvIf Host ^ suppress-error-charset
AddType image/x-icon .ico
AddType application/manifest+json .webmanifest
ErrorDocument 403 https://kaboom.pw/
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^flame.ga$
RewriteRule ^ https://kaboom.pw/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.flame.ga$
RewriteRule ^ https://kaboom.pw/$1 [R=301,L]
ErrorDocument 404 https://kaboom.pw/
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [R=404]
<FilesMatch ".(htm|html)$">
Header set Content-Security-Policy "default-src 'none'; font-src data:; form-action 'self'; img-src 'self'; manifest-src 'self'; style-src 'self'; upgrade-insecure-requests"
@ -16,29 +29,56 @@ Header set X-Frame-Options "DENY"
Header set X-Xss-Protection "1; mode=block"
</FilesMatch>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://kaboom.pw/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://kaboom.pw/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^flame.ga$
RewriteRule ^(.*)$ https://kaboom.pw/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.flame.ga$
RewriteRule ^(.*)$ https://kaboom.pw/$1 [R=301,L]
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
Header set Referrer-Policy "no-referrer"
Header set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
Header set Vary "Accept-Encoding"
Header set X-Content-Type-Options "nosniff"
Header unset Accept-Ranges
Header unset Last-Modified
RewriteCond %{HTTP:Accept-Encoding} br
RewriteCond %{REQUEST_FILENAME}.br -f
RewriteRule ^(.*)$ $1.br [L]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [L]
AddEncoding br .br
AddEncoding gzip .gz
<FilesMatch (.css.br|.css.gz)>
ForceType "text/css; charset=utf-8"
</FilesMatch>
<FilesMatch (.ico.br|.ico.gz)>
ForceType image/x-icon
</FilesMatch>
<FilesMatch (.html.br|.html.gz)>
ForceType "text/html; charset=utf-8"
</FilesMatch>
<FilesMatch (.js.br|.js.gz)>
ForceType "text/javascript; charset=utf-8"
</FilesMatch>
<FilesMatch (.png.br|.png.gz)>
ForceType "image/png; charset=utf-8"
</FilesMatch>
<FilesMatch (.svg.br|.svg.gz)>
ForceType "image/svg+xml; charset=utf-8"
</FilesMatch>
<FilesMatch (.txt.br|.txt.gz)>
ForceType "text/plain; charset=utf-8"
</FilesMatch>
<FilesMatch (.webmanifest.br|.webmanifest.gz)>
ForceType "application/manifest+json; charset=utf-8"
</FilesMatch>
<FilesMatch (.xml.br|.xml.gz)>
ForceType "text/xml; charset=utf-8"
</FilesMatch>

13
build.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
cd $HOME/build-websites/kaboom-website/
rm Gemfile.lock
bundle install
if jekyll build --destination $HOME/html/kaboom.pw/; then
cd $HOME/html/kaboom.pw/
rm -rf *.br
rm -rf *.gz
for file in `find . -type f -name '*'`; do
$HOME/build-websites/zopfli $file
$HOME/build-websites/brotli $file
done
fi