al-quran.reflectslight.io/rules/pages/surah/stream.rules
0x1eef 5f957af84c Set document title at compile time
This change will hopefully make it easier for search engines to
pick up a page's title.
2023-03-12 11:23:48 -03:00

43 lines
1.2 KiB
Ruby

#!/usr/bin/env ruby
# frozen_string_literal: true
##
# Rules for the surah stream available at /<locale>/<name>/ (eg /ar/al-fatihah/)
# and its dependencies.
compile "/*/*/surah.json" do
write(item.identifier.to_s)
if File.size(item.raw_filename) > (1024 * 10)
filter :gzip_text
write("#{item.identifier}.gz")
end
end
Ryo.each(surah_id_to_name) do |surah_id, slug|
locales.each do |locale|
compile "/html/pages/surah/stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
name = i18n[locale].surahs.names[surah_id.to_i - 1]
title = "#{i18n[locale].TheNobleQuran}: #{name}"
filter(:erb, locals: {locale:, surah_id:, title:})
write "/#{locale}/#{slug}/index.html"
end
end
end
compile "/js/pages/surah/stream.tsx" do
filter :webpack, depend_on: ["/js/components", "/js/lib/[!WebPackage]/", "/js/hooks"]
write "/js/pages/surah/stream.js"
filter :gzip_text
write "/js/pages/surah/stream.js.gz"
end
compile "/js/pages/surah/stream/loader.ts" do
filter :webpack, depend_on: "/js/lib/WebPackage"
write "/js/pages/surah/stream/loader.js"
end
compile "/css/pages/surah/stream.scss" do
filter :sass, syntax: :scss, style: :compact
filter :rainpress
write("/css/pages/surah/stream.css")
end