2023-03-02 01:52:25 +01:00
|
|
|
#!/usr/bin/env ruby
|
2023-03-11 18:31:44 +01:00
|
|
|
# frozen_string_literal: true
|
2024-05-04 02:28:26 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
# Contains rules for the the surah stream available
|
2024-05-02 16:29:46 +02:00
|
|
|
# at /<locale>/<name>/, /<locale>/<id>/
|
2023-03-02 01:52:25 +01:00
|
|
|
|
2024-05-15 04:08:04 +02:00
|
|
|
compile "/json/*/*/{surah,info}.json" do
|
2023-03-02 01:52:25 +01:00
|
|
|
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
|
|
|
|
|
2024-05-01 05:00:45 +02:00
|
|
|
Ryo.each(name_by_id) do |id, slug|
|
|
|
|
write_file = ->(locale, pathname:) do
|
2024-05-01 03:41:01 +02:00
|
|
|
name = tdata[locale].surahs.names[id.to_i - 1]
|
2023-10-05 20:59:05 +02:00
|
|
|
context = Ryo.from(
|
2024-05-15 05:20:40 +02:00
|
|
|
filename: "surah-stream.html.erb",
|
2023-10-05 20:59:05 +02:00
|
|
|
locale:,
|
|
|
|
locales:,
|
2024-05-29 08:09:02 +02:00
|
|
|
surah: {id:, name:, slug:},
|
|
|
|
dir: tdata[locale].dir
|
2023-10-05 20:59:05 +02:00
|
|
|
)
|
2024-05-01 05:00:45 +02:00
|
|
|
locals = {
|
|
|
|
locale: context.locale, locales: context.locales,
|
2024-05-29 08:09:02 +02:00
|
|
|
surah: context.surah, dir: context.dir, context:
|
2024-05-01 05:00:45 +02:00
|
|
|
}
|
|
|
|
filter(:erb, locals:)
|
2023-10-08 00:07:34 +02:00
|
|
|
filter(:tidy)
|
2024-05-01 05:00:45 +02:00
|
|
|
write "/#{locale}/#{pathname}/index.html"
|
2023-10-05 20:59:05 +02:00
|
|
|
end
|
2023-03-02 01:52:25 +01:00
|
|
|
locales.each do |locale|
|
2024-05-15 05:20:40 +02:00
|
|
|
compile "/html/main/surah-stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
|
2024-05-01 05:00:45 +02:00
|
|
|
instance_exec(locale, pathname: slug, &write_file)
|
2023-10-05 20:59:05 +02:00
|
|
|
end
|
2024-05-15 05:20:40 +02:00
|
|
|
compile "/html/main/surah-stream.html.erb", rep: "/#{locale}/#{id}/index.html" do
|
2024-05-01 05:00:45 +02:00
|
|
|
instance_exec(locale, pathname: id, &write_file)
|
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
|
2024-06-15 04:31:39 +02:00
|
|
|
filter :webpack, exe: tidy,
|
2024-06-15 04:35:29 +02:00
|
|
|
depend_on: [
|
|
|
|
"/js/components",
|
|
|
|
"/js/lib/",
|
|
|
|
"/js/hooks"
|
|
|
|
]
|
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-06-15 04:31:39 +02:00
|
|
|
filter :webpack, exe: tidy
|
2023-10-08 10:02:01 +02:00
|
|
|
write "/js/loaders/surah-stream-loader.js"
|
2024-06-09 06:02:08 +02:00
|
|
|
filter :gzip
|
|
|
|
write "/js/loaders/surah-stream-loader.js.gz"
|
2023-03-02 01:52:25 +01:00
|
|
|
end
|
|
|
|
|
2024-04-30 02:16:28 +02:00
|
|
|
compile "/css/main/SurahStream.scss" do
|
2023-03-02 01:52:25 +01:00
|
|
|
filter :sass, syntax: :scss, style: :compact
|
|
|
|
filter :rainpress
|
2024-04-30 02:16:28 +02:00
|
|
|
write("/css/main/surah-stream.css")
|
2024-06-09 06:18:08 +02:00
|
|
|
filter :gzip
|
|
|
|
write("/css/main/surah-stream.css.gz")
|
2023-03-02 01:52:25 +01:00
|
|
|
end
|