X-Git-Url: https://git.draconx.ca/gitweb/homepage.git/blobdiff_plain/fe387389cf437d11a969d51b5625cd6bc4ddb79f..19f5d7df33b2deaf3bd2efc68bd3d163c93b194f:/Rules diff --git a/Rules b/Rules index 7acf71d..1aa5907 100644 --- a/Rules +++ b/Rules @@ -70,20 +70,22 @@ preprocess do end create_wkd_items(@items["/pubring.gpg"]) + create_hkp_items(@items["/pubring.gpg"]) end postprocess do # Gzip all text items for nginx http_static - if !ENV['GZIP_SITE'].to_s.empty? + gzip_site = !ENV['GZIP_SITE'].to_s.empty? + if gzip_site reps = @items.flat_map(&:reps).each do |rep| - file = rep.raw_path - next if !file or rep.binary? - - if system("gzip", "-ck9", file, [:out]=>[file + ".gz.tmp", "wb"]) - system("touch", "-r", file, file + ".gz.tmp") - File.rename(file + ".gz.tmp", file + ".gz") - else - File.unlink(file + ".gz.tmp") + next if rep.binary? + rep.instance_variable_get(:@item_rep).raw_paths[:last].each do |f| + if system("gzip", "-nck9", f, [:out]=>["#{f}.gz.tmp", "wb"]) + system("touch", "-r", f, "#{f}.gz.tmp") + File.rename("#{f}.gz.tmp", "#{f}.gz") + else + File.unlink("#{f}.gz.tmp") + end end end end @@ -208,28 +210,38 @@ compile '/images/*.jpg', rep: :info do end compile '/**/*.scss' do - filter :sass, syntax: :scss + filter :sass, syntax: :scss, load_paths: ["."] filter :css_source, uribase: \ "https://git.draconx.ca/gitweb/homepage.git/blob/" + @item[:gitrev] + ":" filter :css_clean_selectors, \ preserve_comments: true, \ preserve_hacks: true + snapshot :before_darkmode + filter :css_darkmode write @item.identifier.without_ext + '.css' end -compile '/gpg/*' do - filter :wkd_export, armor: true - write "/pubring/" + @item.identifier.components.last + ".asc" +compile '/style.scss', rep: :dark do + filter :compiled_content, snapshot: :before_darkmode + filter :css_darkmode, alternate: true + write "/dark.css" end -compile '/gpg/*', rep: :hu do - filter :wkd_export - write "/pubring/wkd/" + @item[:wkd_hash] +compile '/gpg/*' do + filter :wkd_export_armor + write "/pubring/#{@item.identifier.components.last}.asc" + write "/pubring/#{@item[:id64]}.asc" if @item[:id64] + write "/pubring/#{@item[:id32]}.asc" if @item[:id32] end -compile '/*.gpg' do +compile '/gpg/*', rep: :hu do + if @item[:wkd_hash] + filter :wkd_export + write "/pubring/wkd/" + @item[:wkd_hash] + end end +ignore '/*.gpg' compile '/**/*.svg' do filter :scour, comment_stripping: true