al-quran.reflectslight.io/nanoc/rules/stream.rules

60 lines
1.5 KiB
Text
Raw Normal View History

#!/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>/.
2024-04-30 05:11:00 +02:00
compile "/json/*/*/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
write("#{item.identifier}.gz")
end
end
Ryo.each(name_by_id) do |id, slug|
write_file = ->(locale, pathname:) do
name = tdata[locale].surahs.names[id.to_i - 1]
context = Ryo.from(
filename: "stream.html.erb",
locale:,
locales:,
surah: {id:, name:, slug:}
)
locals = {
locale: context.locale, locales: context.locales,
surah: context.surah, context:
}
filter(:erb, locals:)
filter(:tidy)
write "/#{locale}/#{pathname}/index.html"
end
locales.each do |locale|
compile "/html/stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
instance_exec(locale, pathname: slug, &write_file)
end
compile "/html/stream.html.erb", rep: "/#{locale}/#{id}/index.html" do
instance_exec(locale, pathname: id, &write_file)
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,
2024-03-17 01:31:06 +01: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"
end
compile "/js/loaders/SurahStreamLoader.ts" do
2024-03-16 08:56:56 +01:00
filter :webpack
write "/js/loaders/surah-stream-loader.js"
end
2024-04-30 02:16:28 +02:00
compile "/css/main/SurahStream.scss" do
filter :sass, syntax: :scss, style: :compact
filter :rainpress
2024-04-30 02:16:28 +02:00
write("/css/main/surah-stream.css")
end