2023-03-02 01:52:25 +01:00
|
|
|
#!/usr/bin/env ruby
|
2023-03-11 18:31:44 +01:00
|
|
|
# frozen_string_literal: true
|
2023-03-10 14:51:34 +01:00
|
|
|
|
|
|
|
##
|
2024-03-16 08:56:56 +01:00
|
|
|
# Rules for the surah stream available at /<locale>/<name>/.
|
2023-03-02 01:52:25 +01:00
|
|
|
|
|
|
|
compile "/*/*/surah.json" do
|
|
|
|
write(item.identifier.to_s)
|
|
|
|
if File.size(item.raw_filename) > (1024 * 10)
|
2023-06-30 00:49:42 +02:00
|
|
|
filter :gzip
|
2023-03-02 01:52:25 +01:00
|
|
|
write("#{item.identifier}.gz")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-10-05 16:51:39 +02:00
|
|
|
Ryo.each(slugs) do |id, slug|
|
2023-10-05 20:59:05 +02:00
|
|
|
writer = ->(locale, identifier:) do
|
|
|
|
name = i18n[locale].surahs.names[id.to_i - 1]
|
|
|
|
context = Ryo.from(
|
|
|
|
filename: "stream.html.erb",
|
|
|
|
locale:,
|
|
|
|
locales:,
|
|
|
|
surah: {id:, name:, slug:}
|
|
|
|
)
|
|
|
|
filter(:erb, locals: {context:})
|
2023-10-08 00:07:34 +02:00
|
|
|
filter(:tidy)
|
2023-10-05 20:59:05 +02:00
|
|
|
write "/#{locale}/#{identifier}/index.html"
|
|
|
|
end
|
2023-03-02 01:52:25 +01:00
|
|
|
locales.each do |locale|
|
2023-10-08 10:02:01 +02:00
|
|
|
compile "/html/stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
|
2023-10-05 20:59:05 +02:00
|
|
|
instance_exec(locale, identifier: slug, &writer)
|
|
|
|
end
|
2023-10-08 10:02:01 +02:00
|
|
|
compile "/html/stream.html.erb", rep: "/#{locale}/#{id}/index.html" do
|
2023-10-05 20:59:05 +02:00
|
|
|
instance_exec(locale, identifier: id, &writer)
|
2023-03-02 01:52:25 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-03-16 08:56:56 +01:00
|
|
|
compile "/js/main/surah-stream.tsx" do
|
2023-03-27 17:23:20 +02:00
|
|
|
filter :webpack,
|
|
|
|
depend_on: ["/js/components", "/js/lib/", "/js/hooks"],
|
2023-05-29 03:28:15 +02:00
|
|
|
reject: proc { _1.include?("WebPackage") }
|
2024-03-16 08:56:56 +01:00
|
|
|
write "/js/main/surah-stream.js"
|
2023-06-30 00:49:42 +02:00
|
|
|
filter :gzip
|
2024-03-16 08:56:56 +01:00
|
|
|
write "/js/main/surah-stream.js.gz"
|
2023-03-02 01:52:25 +01:00
|
|
|
end
|
|
|
|
|
2023-10-08 10:02:01 +02:00
|
|
|
compile "/js/loaders/SurahStreamLoader.ts" do
|
2024-03-16 08:56:56 +01:00
|
|
|
filter :webpack
|
2023-10-08 10:02:01 +02:00
|
|
|
write "/js/loaders/surah-stream-loader.js"
|
2023-03-02 01:52:25 +01:00
|
|
|
end
|
|
|
|
|
2023-10-08 10:02:01 +02:00
|
|
|
compile "/css/pages/SurahStream.scss" do
|
2023-03-02 01:52:25 +01:00
|
|
|
filter :sass, syntax: :scss, style: :compact
|
|
|
|
filter :rainpress
|
2023-10-30 00:24:26 +01:00
|
|
|
write("/css/surah-stream.css")
|
2023-03-02 01:52:25 +01:00
|
|
|
end
|